Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: banner with telegram info #104

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion directus
Submodule directus updated 4 files
+4 −1 directus.yaml
+14 −11 flows.sql
+283 −244 snapshot.yaml
+4,806 −4,888 types/schema.d.ts
37 changes: 37 additions & 0 deletions src/components/ChannelsList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import DirectusImage from "./DirectusImage";
import { useTranslationTable } from "@/locales";
import styles from "@/styles/ChannelsList.module.scss";
import { SocialLink } from "@/types/aliases";

function Channel({ channel }: { channel: SocialLink }) {
return (
<a className={styles.channel} href={channel.link || ""} target="_blank">
<DirectusImage
className={styles.image}
name={channel.account_name}
img={channel.logo}
sizes="5rem"
cover
/>
<p>{channel.account_name}</p>
</a>
);
}

export default function ChannelsList(props: { channels: SocialLink[] }) {
const tt = useTranslationTable();
return (
<div className={styles.main}>
<h1>{tt["join-our-channels"]}</h1>
<div className={styles.list}>
{props.channels
.sort(
(a, b) => a.account_name?.localeCompare(b.account_name || "") || -1
)
.map((c) => (
<Channel channel={c} key={c.id} />
))}
</div>
</div>
);
}
27 changes: 19 additions & 8 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Decoration from "@/assets/decoration.svg";
import PreviewImage from "@/assets/galleryPreview.png";
import AssociationDescription from "@/components/AssociationDescription";
import Button from "@/components/Button";
import ChannelsList from "@/components/ChannelsList";
import DirectusImage from "@/components/DirectusImage";
import Gallery from "@/components/Gallery";
import MembersList from "@/components/MembersList";
Expand All @@ -16,11 +17,7 @@ import {
getDirectusImageUrl,
populateLayoutProps,
} from "@/directus";
import {
getTranslation,
queryTranslations,
useTranslationTable,
} from "@/locales";
import { getTranslation, useTranslationTable } from "@/locales";
import styles from "@/styles/Homepage.module.scss";
import {
Association,
Expand Down Expand Up @@ -77,6 +74,8 @@ export default function Home(

<PartnersList id="partners" partners={props.partners} background={true} />

<ChannelsList channels={props.association.channels as SocialLink[]} />

<div className={styles.associationDesciption}>
<div className={styles.center}>
<AssociationDescription
Expand Down Expand Up @@ -111,11 +110,23 @@ export const getServerSideProps: GetServerSideProps<
gallery: any[];
} & LayoutProps
> = populateLayoutProps(async (_) => {
var association = await directus().request(
readSingleton("association", {
fields: [
"*",
// @ts-expect-error
{ translations: ["*"] },
// @ts-expect-error
{ channels: ["*", { social_links_id: ["*"] }] },
],
})
);

association.channels = association.channels?.map((c) => c.social_links_id);

return {
props: {
association: await directus().request(
readSingleton("association", queryTranslations as any)
),
association,
partners: (await directus()
.request(
readItems("association_partners", {
Expand Down
43 changes: 43 additions & 0 deletions src/styles/ChannelsList.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@use "./utilities/variables";

.main {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: variables.$white-background-color;
padding-top: 2rem;
}

.image {
width: 6rem;
height: 6rem;
clip-path: circle();
}

.channel {
max-width: 6rem;

&:hover {
transition: transform 0.2s ease;
transform: translateY(-5px);
}
}

.list {
padding-top: 1rem;
display: flex;
gap: 4rem;
width: 100%;
align-items: baseline;
justify-content: center;

p {
margin: 0.5rem 0 0 0;
font-weight: 400;

color: variables.$dark-text-color;
text-align: center;
}
}
Loading