Skip to content

Commit

Permalink
Fix minor issues
Browse files Browse the repository at this point in the history
  • Loading branch information
souljja committed Jul 14, 2024
1 parent 5056deb commit 6775f7a
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 32 deletions.
12 changes: 6 additions & 6 deletions src/__generated__/gql.ts

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions src/__generated__/graphql.ts

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/app/[locale]/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { notFound } from "next/navigation";
import { getClient } from "@/utils/apollo-client";
import { isNotNull } from "@/utils/type-guards/is-not-null";
import { GET_LAYOUT_DATA } from "@/queries/get-layout-data";
import { GET_PAGE1_DATA } from "@/queries/get-page1-data";
import { GET_PAGES_DATA } from "@/queries/get-pages-data.ts";
import {
LAYOUT_PAGES_VARIABLES,
PAGE_SIZE,
Expand Down Expand Up @@ -102,7 +102,7 @@ export default async function Home({
});

const { data } = await client.query({
query: GET_PAGE1_DATA,
query: GET_PAGES_DATA,
variables: {
slug: { startsWith: slug },
page: START_PAGE,
Expand Down
5 changes: 3 additions & 2 deletions src/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default async function LocaleLayout({
const client = getClient();
const { data } = await client.query<GetLayoutDataQuery>({
query: GET_LAYOUT_DATA,
variables: LAYOUT_PAGES_VARIABLES,
variables: { ...LAYOUT_PAGES_VARIABLES, locale },
});

const footer = data?.footer?.data?.attributes;
Expand All @@ -44,10 +44,11 @@ export default async function LocaleLayout({
/>
<main className="main-content">{children}</main>
<Footer
// TODO: check if shared social icon can be optional
socialLinks={footer?.socialMedia as ComponentSharedSocialIcon[]}
navigation={footer?.navigation?.data as PageEntity[]}
heading={footer?.heading ?? ""}
tradeMark={footer?.tradeMark ?? ""}
rights={footer?.rights ?? ""}
/>
</div>
</>
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "@/styles/index.scss";
// eslint-disable-next-line import/no-default-export,react/function-component-definition
export default function RootLayout({ children }: PropsWithChildren<unknown>) {
return (
<html lang="kz">
<html lang="kk">
<head>
<meta charSet="UTF-8" />
<link rel="icon" type="image/png" href="/assets/favicon.png" />
Expand Down
4 changes: 4 additions & 0 deletions src/components/footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@

&-delimiter {
display: none;

&:only-child {
display: none;
}
}
}

Expand Down
16 changes: 11 additions & 5 deletions src/components/footer/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@ export interface FooterProps {
socialLinks?: ComponentSharedSocialIcon[];
navigation?: PageEntity[];
heading?: string;
tradeMark?: string;
rights?: string;
}

export const Footer = ({ socialLinks, heading, navigation }: FooterProps) => {
const currentYear = new Date().getFullYear();

export const Footer = ({
socialLinks,
heading,
navigation,
tradeMark,
rights,
}: FooterProps) => {
return (
<footer className="footer">
<div className="footer-content">
Expand Down Expand Up @@ -47,9 +53,9 @@ export const Footer = ({ socialLinks, heading, navigation }: FooterProps) => {
})}
</div>
<div className="copyright-info">
<span>© {currentYear} | Connect-Ed</span>
{tradeMark && <span>{tradeMark}</span>}
<span className="copyright-info-delimiter"> | </span>
<span>Все права защищены | [email protected]</span>
{rights && <span>{rights}</span>}
</div>
<div className="designed-by">
<span>Designed by</span>
Expand Down
3 changes: 3 additions & 0 deletions src/features/categorized-news/categorized-news.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useMemo, useState } from "react";
import { useApolloClient, useLazyQuery } from "@apollo/client";
import { useParams } from "next/navigation";
import { LoadingButton } from "@/components/loading-button/loading-button.tsx";
import { NewsCard } from "@/components/news-card/news-card.tsx";
import { SectionBase } from "@/components/section-base/section-base.tsx";
Expand All @@ -28,6 +29,7 @@ export interface CategorizedNewsProps {
const initialTabs: ArticleCategoryEntity[] = [];

export const CategorizedNews = ({ data }: CategorizedNewsProps) => {
const { locale } = useParams();
const [page, setPage] = useState(START_PAGE + 1);

const client = useApolloClient();
Expand Down Expand Up @@ -80,6 +82,7 @@ export const CategorizedNews = ({ data }: CategorizedNewsProps) => {
category: currentTab,
page: page,
pageSize: PAGE_SIZE,
locale,
},
}).then(() => {
setPage(prevState => prevState + 1);
Expand Down
4 changes: 2 additions & 2 deletions src/features/html-lang/html-lang.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";

import { useEffect } from "react";
import { useLayoutEffect } from "react";

export const HtmlLang = ({ lang }: { lang: string }) => {
useEffect(() => {
useLayoutEffect(() => {
document.documentElement.setAttribute("lang", lang);
}, [lang]);

Expand Down
2 changes: 1 addition & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const localesConfig = [
{
emoji: "🇰🇿",
label: "kazakh",
value: "kz",
value: "kk",
},
{
emoji: "🇷🇺",
Expand Down
9 changes: 5 additions & 4 deletions src/queries/get-layout-data.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gql } from "@/__generated__";

export const GET_LAYOUT_DATA = gql(`
query GetLayoutData($limit: Int) {
pages(pagination: { limit: $limit }) {
query GetLayoutData($limit: Int, $locale: I18NLocaleCode) {
pages(pagination: { limit: $limit }, locale: $locale) {
data {
id
attributes {
Expand All @@ -24,7 +24,7 @@ query GetLayoutData($limit: Int) {
}
}
}
header {
header(locale: $locale) {
data {
attributes {
logo {
Expand Down Expand Up @@ -86,7 +86,7 @@ query GetLayoutData($limit: Int) {
}
}
}
footer {
footer(locale: $locale) {
data {
attributes {
theme {
Expand All @@ -111,6 +111,7 @@ query GetLayoutData($limit: Int) {
}
heading
tradeMark
rights
navigation {
data {
attributes {
Expand Down
3 changes: 2 additions & 1 deletion src/queries/get-news-by-category.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { gql } from "@/__generated__";

export const GET_NEWS_BY_CATEGORY = gql(`
query GetNewsByCategory($category: String!, $page: Int!, $pageSize: Int!) {
query GetNewsByCategory($category: String!, $page: Int!, $pageSize: Int!, $locale: I18NLocaleCode) {
articles(
filters: { article_category: { slug: { in: [$category] } } }
pagination: { page: $page, pageSize: $pageSize }
locale: $locale
) {
meta {
pagination {
Expand Down
5 changes: 3 additions & 2 deletions src/queries/get-page.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { gql } from "@/__generated__";

export const GET_PAGE_DATA = gql(`
query GetPageData($id: ID, $page: Int!, $pageSize: Int!) {
page(id: $id) {
query GetPageData($id: ID, $page: Int!, $pageSize: Int!, $locale: I18NLocaleCode) {
page(id: $id, locale: $locale) {
data {
attributes {
label
Expand Down Expand Up @@ -232,6 +232,7 @@ query GetPageData($id: ID, $page: Int!, $pageSize: Int!) {
}
}
}
locale
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { gql } from "@/__generated__";

export const GET_PAGE1_DATA = gql(`
export const GET_PAGES_DATA = gql(`
query GetPage1Data($slug: StringFilterInput, $locale: I18NLocaleCode, $page: Int!, $pageSize: Int!) {
pages(filters: { slug: $slug }, locale: $locale) {
data {
Expand Down

0 comments on commit 6775f7a

Please sign in to comment.