chore: update

This commit is contained in:
2025-07-15 17:28:41 +02:00
parent c7ef1146b3
commit 7c93cd76d9
38 changed files with 6306 additions and 11016 deletions

View File

@@ -3,7 +3,6 @@ import React from "react";
import * as styles from "./Icon.module.scss";
import { ICONS } from "@/constants";
interface Props {
name: keyof typeof ICONS;
icon: {

View File

@@ -1,11 +1,7 @@
import React, { FC } from "react";
import { graphql, StaticQuery } from "gatsby";
import {
GatsbyImage,
GatsbyImageProps,
IGatsbyImageData,
} from "gatsby-plugin-image";
import { GatsbyImage, GatsbyImageProps, IGatsbyImageData } from "gatsby-plugin-image";
import { FileSystemNode } from "gatsby-source-filesystem";
interface Props extends Omit<GatsbyImageProps, "image"> {
@@ -28,9 +24,7 @@ const Image: FC<Props> = ({ path, ...rest }: Props) => (
<StaticQuery
query={graphql`
query {
images: allFile(
filter: { ext: { regex: "/png|jpg|jpeg|webp|tif|tiff/" } }
) {
images: allFile(filter: { ext: { regex: "/png|jpg|jpeg|webp|tif|tiff/" } }) {
edges {
node {
absolutePath

View File

@@ -1,9 +1,9 @@
import React from "react";
import Helmet from "react-helmet";
import { useSiteMetadata } from "@/hooks";
import { CookieBar } from "../Cookiebar/CookieBar";
import * as styles from "./Layout.module.scss";
import { useSiteMetadata } from "@/hooks";
interface Props {
title: string;
@@ -20,7 +20,6 @@ const Layout: React.FC<Props> = ({
description,
socialImage = "",
noIndex = false,
slug,
}: Props) => {
const { author, url } = useSiteMetadata();
const metaImage = socialImage || author.photo;

View File

@@ -11,9 +11,7 @@ describe("Page", () => {
title: mocks.markdownRemark.frontmatter.title,
};
const tree = renderer
.create(<Page {...props}>{props.children}</Page>)
.toJSON();
const tree = renderer.create(<Page {...props}>{props.children}</Page>).toJSON();
expect(tree).toMatchSnapshot();
});
});

View File

@@ -1,8 +1,8 @@
import React, { useEffect, useRef } from "react";
import type { Nullable } from "@/types";
import { Helmet } from "react-helmet";
import * as styles from "./Page.module.scss";
import type { Nullable } from "@/types";
interface Props {
title?: string;

View File

@@ -1,8 +1,8 @@
import { PAGINATION } from "@/constants";
import classNames from "classnames";
import { Link } from "gatsby";
import React from "react";
import * as styles from "./Pagination.module.scss";
import { PAGINATION } from "@/constants";
type Props = {
prevPagePath: string;

View File

@@ -1,6 +1,6 @@
import { useSiteMetadata } from "@/hooks";
import React from "react";
import * as styles from "./Author.module.scss";
import { useSiteMetadata } from "@/hooks";
const Author = () => {
const { author } = useSiteMetadata();
@@ -13,6 +13,7 @@ const Author = () => {
<strong>{author.name}</strong>
</a>
{typeof window !== "undefined" ? (
// eslint-disable-next-line no-undef
<span className="showInPrintView"> {window ? `@ ${window.location}` : ""}</span>
) : (
""

View File

@@ -1,8 +1,8 @@
import { Content } from "@/components/Post/Content";
import * as mocks from "@/mocks";
import { StaticQuery, useStaticQuery } from "gatsby";
import React from "react";
import renderer from "react-test-renderer";
import * as mocks from "@/mocks";
import { Content } from "@/components/Post/Content";
const mockedStaticQuery = StaticQuery as jest.Mock;
const mockedUseStaticQuery = useStaticQuery as jest.Mock;

View File

@@ -1,4 +1,3 @@
import type { Node } from "@/types";
import React from "react";
import { Helmet } from "react-helmet";
import { useSiteMetadata } from "../../hooks";
@@ -8,6 +7,7 @@ import { Content } from "./Content";
import { Meta } from "./Meta";
import * as styles from "./Post.module.scss";
import { Tags } from "./Tags";
import type { Node } from "@/types";
interface Props {
post: Node;

View File

@@ -1,8 +1,8 @@
import { Image } from "@/components/Image";
import { Link, navigate } from "gatsby";
import React, { FunctionComponent } from "react";
import { ThemeSwitcher } from "../ThemeSwitcher/ThemeSwitcher";
import * as styles from "./PostHeader.module.scss";
import { Image } from "@/components/Image";
type Props = { author: { name: string; photo: string } };

View File

@@ -5,7 +5,6 @@ import { Link } from "gatsby";
import * as styles from "./Author.module.scss";
import { Image } from "@/components/Image";
type Props = {
author: {
name: string;

View File

@@ -1,4 +1,3 @@
import { useSiteMetadata } from "@/hooks";
import React from "react";
import { ThemeSwitcher } from "../ThemeSwitcher/ThemeSwitcher";
import { Author } from "./Author";
@@ -6,6 +5,7 @@ import { Contacts } from "./Contacts";
import { Copyright } from "./Copyright";
import { Menu } from "./Menu";
import * as styles from "./Sidebar.module.scss";
import { useSiteMetadata } from "@/hooks";
type Props = {
isIndex?: boolean;

View File

@@ -1,3 +1,4 @@
/* eslint-disable max-len */
const ICONS = {
twitter: {
path: "M25.312 6.375c-0.688 1-1.547 1.891-2.531 2.609 0.016 0.219 0.016 0.438 0.016 0.656 0 6.672-5.078 14.359-14.359 14.359-2.859 0-5.516-0.828-7.75-2.266 0.406 0.047 0.797 0.063 1.219 0.063 2.359 0 4.531-0.797 6.266-2.156-2.219-0.047-4.078-1.5-4.719-3.5 0.313 0.047 0.625 0.078 0.953 0.078 0.453 0 0.906-0.063 1.328-0.172-2.312-0.469-4.047-2.5-4.047-4.953v-0.063c0.672 0.375 1.453 0.609 2.281 0.641-1.359-0.906-2.25-2.453-2.25-4.203 0-0.938 0.25-1.797 0.688-2.547 2.484 3.062 6.219 5.063 10.406 5.281-0.078-0.375-0.125-0.766-0.125-1.156 0-2.781 2.25-5.047 5.047-5.047 1.453 0 2.766 0.609 3.687 1.594 1.141-0.219 2.234-0.641 3.203-1.219-0.375 1.172-1.172 2.156-2.219 2.781 1.016-0.109 2-0.391 2.906-0.781z",

View File

@@ -10,20 +10,18 @@ interface CategoriesQueryResult {
}
const useCategoriesList = () => {
const { allMarkdownRemark } = useStaticQuery<CategoriesQueryResult>(
graphql`
query CategoriesListQuery {
allMarkdownRemark(
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) {
group(field: { frontmatter: { category: SELECT } }) {
fieldValue
totalCount
}
const { allMarkdownRemark } = useStaticQuery<CategoriesQueryResult>(graphql`
query CategoriesListQuery {
allMarkdownRemark(
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) {
group(field: { frontmatter: { category: SELECT } }) {
fieldValue
totalCount
}
}
`
);
}
`);
return allMarkdownRemark.group ?? [];
};

View File

@@ -1,52 +1,50 @@
import { graphql, useStaticQuery } from "gatsby";
const useSiteMetadata = () => {
const { site } = useStaticQuery(
graphql`
query SiteMetaData {
site {
siteMetadata {
author {
bio
name
photo
contacts {
rss
line
email
weibo
gitlab
medium
github
twitter
codepen
youtube
facebook
linkedin
telegram
instagram
soundcloud
phone
}
const { site } = useStaticQuery(graphql`
query SiteMetaData {
site {
siteMetadata {
author {
bio
name
photo
contacts {
rss
line
email
weibo
gitlab
medium
github
twitter
codepen
youtube
facebook
linkedin
telegram
instagram
soundcloud
phone
}
menu {
path
label
}
legalMenu {
path
label
}
url
title
subtitle
copyright
disqusShortname
}
menu {
path
label
}
legalMenu {
path
label
}
url
title
subtitle
copyright
disqusShortname
}
}
`
);
}
`);
return site.siteMetadata;
};

View File

@@ -10,20 +10,18 @@ interface TagsQueryResult {
}
const useTagsList = () => {
const { allMarkdownRemark } = useStaticQuery<TagsQueryResult>(
graphql`
query TagsListQuery {
allMarkdownRemark(
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) {
group(field: { frontmatter: { tags: SELECT } }) {
fieldValue
totalCount
}
const { allMarkdownRemark } = useStaticQuery<TagsQueryResult>(graphql`
query TagsListQuery {
allMarkdownRemark(
filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) {
group(field: { frontmatter: { tags: SELECT } }) {
fieldValue
totalCount
}
}
`
);
}
`);
return allMarkdownRemark.group || [];
};

View File

@@ -1,10 +1,10 @@
import React from "react";
import { Link } from "gatsby";
import { Layout } from "@/components/Layout";
import { Page } from "@/components/Page";
import { Sidebar } from "@/components/Sidebar";
import { useSiteMetadata } from "@/hooks";
import { Link } from "gatsby";
const NotFoundTemplate: React.FC = () => {
const { title, subtitle } = useSiteMetadata();