fix: error
This commit is contained in:
113
package.json
113
package.json
@@ -2,6 +2,7 @@
|
|||||||
"name": "codesecer-ui",
|
"name": "codesecer-ui",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "tsc && vite build",
|
"build": "tsc && vite build",
|
||||||
@@ -16,79 +17,77 @@
|
|||||||
"chromatic": "npx chromatic --project-token=180ac2186305"
|
"chromatic": "npx chromatic --project-token=180ac2186305"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mantine/core": "^7.1.7",
|
"@mantine/core": "^7.6.2",
|
||||||
"@mantine/ds": "^7.1.7",
|
"@mantine/hooks": "^7.6.2",
|
||||||
"@mantine/hooks": "^7.1.7",
|
"@mantine/notifications": "^7.6.2",
|
||||||
"@mantine/notifications": "^7.1.7",
|
"@reduxjs/toolkit": "^2.2.1",
|
||||||
"@reduxjs/toolkit": "^1.9.7",
|
"@tabler/icons-react": "^3.1.0",
|
||||||
"@tabler/icons-react": "^2.40.0",
|
"axios": "^1.6.8",
|
||||||
"axios": "^1.6.0",
|
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"i18next": "^23.6.0",
|
"i18next": "^23.10.1",
|
||||||
"i18next-browser-languagedetector": "^7.1.0",
|
"i18next-browser-languagedetector": "^7.2.0",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
"react-dom": "^18.2.0",
|
"react-dom": "^18.2.0",
|
||||||
"react-i18next": "^13.3.1",
|
"react-i18next": "^14.1.0",
|
||||||
"react-redux": "^8.1.3",
|
"react-redux": "^9.1.0",
|
||||||
"react-router-dom": "^6.18.0",
|
"react-router-dom": "^6.22.3",
|
||||||
"remark": "^15.0.1",
|
"remark": "^15.0.1",
|
||||||
"remark-html": "^16.0.1"
|
"remark-html": "^16.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.23.2",
|
"@babel/core": "^7.24.0",
|
||||||
"@mantine/form": "^7.1.7",
|
"@mantine/form": "^7.6.2",
|
||||||
"@storybook/addon-actions": "^7.5.2",
|
"@storybook/addon-actions": "^8.0.1",
|
||||||
"@storybook/addon-essentials": "^7.5.2",
|
"@storybook/addon-essentials": "^8.0.1",
|
||||||
"@storybook/addon-interactions": "^7.5.2",
|
"@storybook/addon-interactions": "^8.0.1",
|
||||||
"@storybook/addon-links": "^7.5.2",
|
"@storybook/addon-links": "^8.0.1",
|
||||||
"@storybook/addons": "^7.5.2",
|
"@storybook/addons": "^7.6.17",
|
||||||
"@storybook/api": "^7.5.2",
|
"@storybook/api": "^7.6.17",
|
||||||
"@storybook/builder-vite": "^7.5.2",
|
"@storybook/builder-vite": "^8.0.1",
|
||||||
"@storybook/components": "^7.5.2",
|
"@storybook/components": "^8.0.1",
|
||||||
"@storybook/core-events": "^7.5.2",
|
"@storybook/core-events": "^8.0.1",
|
||||||
"@storybook/react": "^7.5.2",
|
"@storybook/react": "^8.0.1",
|
||||||
"@storybook/testing-library": "^0.2.2",
|
"@storybook/testing-library": "^0.2.2",
|
||||||
"@storybook/theming": "^7.5.2",
|
"@storybook/theming": "^8.0.1",
|
||||||
"@testing-library/dom": "^9.3.3",
|
"@testing-library/dom": "^9.3.4",
|
||||||
"@testing-library/jest-dom": "^6.1.4",
|
"@testing-library/jest-dom": "^6.4.2",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.2.1",
|
||||||
"@testing-library/user-event": "^14.5.1",
|
"@testing-library/user-event": "^14.5.2",
|
||||||
"@types/jest": "^29.5.7",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/lodash": "^4.14.200",
|
"@types/lodash": "^4.17.0",
|
||||||
"@types/react": "^18.2.33",
|
"@types/react": "^18.2.67",
|
||||||
"@types/react-dom": "^18.2.14",
|
"@types/react-dom": "^18.2.22",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.9.1",
|
"@typescript-eslint/eslint-plugin": "^7.3.1",
|
||||||
"@typescript-eslint/parser": "^6.9.1",
|
"@typescript-eslint/parser": "^7.3.1",
|
||||||
"@vitejs/plugin-react": "^4.1.0",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
"babel-loader": "^9.1.3",
|
"babel-loader": "^9.1.3",
|
||||||
"chromatic": "^7.6.0",
|
"chromatic": "^11.0.8",
|
||||||
"eslint": "^8.52.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^9.0.0",
|
"eslint-config-prettier": "^9.1.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
"eslint-plugin-import": "^2.29.0",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.7.1",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
"eslint-plugin-prettier": "^5.0.1",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"eslint-plugin-react": "^7.33.2",
|
"eslint-plugin-react": "^7.34.1",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.4",
|
"eslint-plugin-react-refresh": "^0.4.6",
|
||||||
"eslint-plugin-storybook": "^0.6.15",
|
"eslint-plugin-storybook": "^0.8.0",
|
||||||
"i18next-http-backend": "^2.3.1",
|
"i18next-http-backend": "^2.5.0",
|
||||||
"install-peerdeps": "^3.0.3",
|
"install-peerdeps": "^3.0.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-environment-jsdom": "^29.7.0",
|
"jest-environment-jsdom": "^29.7.0",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.4.36",
|
||||||
"postcss-preset-mantine": "^1.9.0",
|
"postcss-preset-mantine": "^1.13.0",
|
||||||
"postcss-simple-vars": "^7.0.1",
|
"postcss-simple-vars": "^7.0.1",
|
||||||
"prettier": "^3.0.3",
|
"prettier": "^3.2.5",
|
||||||
"react-router": "^6.18.0",
|
"react-router": "^6.22.3",
|
||||||
"storybook": "^7.5.2",
|
"storybook": "^8.0.1",
|
||||||
"storybook-addon-react-router-v6": "2.0.8",
|
"storybook-dark-mode": "^4.0.1",
|
||||||
"storybook-dark-mode": "^3.0.1",
|
"storybook-react-i18next": "3.0.1",
|
||||||
"storybook-react-i18next": "2.0.9",
|
|
||||||
"stylis-plugin-rtl": "^2.1.1",
|
"stylis-plugin-rtl": "^2.1.1",
|
||||||
"ts-jest": "^29.1.1",
|
"ts-jest": "^29.1.2",
|
||||||
"typescript": "^5.2.2",
|
"typescript": "^5.4.2",
|
||||||
"vite": "^4.5.0"
|
"vite": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
7079
pnpm-lock.yaml
generated
7079
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
module.exports = {
|
export default {
|
||||||
plugins: {
|
plugins: {
|
||||||
"postcss-preset-mantine": {},
|
"postcss-preset-mantine": {},
|
||||||
"postcss-simple-vars": {
|
"postcss-simple-vars": {
|
||||||
|
|||||||
@@ -4,15 +4,15 @@ import {
|
|||||||
SegmentedControl,
|
SegmentedControl,
|
||||||
useMantineColorScheme,
|
useMantineColorScheme,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import { IconMoon, IconSun } from "@tabler/icons-react";
|
import { IconMoon, IconRobot, IconSun } from "@tabler/icons-react";
|
||||||
|
|
||||||
export function ThemeSetting() {
|
export function ThemeSetting() {
|
||||||
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
|
const { colorScheme, setColorScheme } = useMantineColorScheme();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SegmentedControl
|
<SegmentedControl
|
||||||
value={colorScheme}
|
value={colorScheme}
|
||||||
onChange={toggleColorScheme}
|
onChange={v => setColorScheme(v as any)}
|
||||||
data={[
|
data={[
|
||||||
{
|
{
|
||||||
value: "light",
|
value: "light",
|
||||||
@@ -23,6 +23,15 @@ export function ThemeSetting() {
|
|||||||
</Center>
|
</Center>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: "auto",
|
||||||
|
label: (
|
||||||
|
<Center>
|
||||||
|
<IconRobot size="1rem" stroke={1.5} />
|
||||||
|
<Box ml={10}>Auto</Box>
|
||||||
|
</Center>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: "dark",
|
value: "dark",
|
||||||
label: (
|
label: (
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { notifications } from "@mantine/notifications";
|
import { notifications } from "@mantine/notifications";
|
||||||
import axios, { AxiosResponse } from "axios";
|
import axios, { AxiosResponse } from "axios";
|
||||||
|
import { merge } from "lodash";
|
||||||
|
|
||||||
export interface PaginationParams {
|
export interface PaginationParams {
|
||||||
skip?: number;
|
skip?: number;
|
||||||
@@ -63,6 +64,6 @@ export class SearchApi {
|
|||||||
const { data } = await api.get(
|
const { data } = await api.get(
|
||||||
new URL(`/api/paragraph/_doc/${id}`, baseUrl).toString(),
|
new URL(`/api/paragraph/_doc/${id}`, baseUrl).toString(),
|
||||||
);
|
);
|
||||||
return data._source;
|
return merge(data._source, { _id: data._id, '@timestamp': data['@timestamp'] });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,23 +57,24 @@ export default function ParagraphPage() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Container py="2rem">
|
<Container py="2rem">
|
||||||
<Title mb="xl">{paragraph.title}</Title>
|
<Title >{paragraph.title}</Title>
|
||||||
<Group justify="space-between" align="center">
|
<Group justify="space-between" align="center" my="md">
|
||||||
<Group>
|
<Group>
|
||||||
<Text c="dimmed"> {dayjs().to(dayjs(paragraph.time))}</Text>
|
<Text size="sm" c="dimmed"> {dayjs().to(dayjs(paragraph["@timestamp"]))}</Text>
|
||||||
<Badge
|
<Text
|
||||||
ml="1rem"
|
ml="1rem"
|
||||||
radius="sm"
|
size="sm"
|
||||||
component={Link}
|
component={Link}
|
||||||
to={`/author/${encodeURIComponent(paragraph.author || "unknown")}`}
|
to={`/author/${encodeURIComponent(paragraph.author || "unknown")}`}
|
||||||
>
|
>
|
||||||
{paragraph.author}
|
{paragraph.author}
|
||||||
</Badge>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
<Group>
|
<Group>
|
||||||
{paragraph.tags.map((tag, index) => (
|
{paragraph.tags.map((tag, index) => (
|
||||||
<>
|
<>
|
||||||
<Badge
|
<Badge
|
||||||
|
size="sm"
|
||||||
component={Link}
|
component={Link}
|
||||||
key={index}
|
key={index}
|
||||||
to={`/tag/${encodeURIComponent(tag)}`}
|
to={`/tag/${encodeURIComponent(tag)}`}
|
||||||
@@ -82,6 +83,13 @@ export default function ParagraphPage() {
|
|||||||
</Badge>
|
</Badge>
|
||||||
</>
|
</>
|
||||||
))}
|
))}
|
||||||
|
{
|
||||||
|
paragraph.source_url && (
|
||||||
|
<a href={paragraph.source_url}>
|
||||||
|
Goto Source
|
||||||
|
</a>
|
||||||
|
)
|
||||||
|
}
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Grid, Group } from "@mantine/core";
|
import { Container, Grid, Group } from "@mantine/core";
|
||||||
import { useContext, useEffect } from "react";
|
import { useContext, useEffect } from "react";
|
||||||
import { useLoaderData, useLocation, useParams } from "react-router";
|
import { useLoaderData, useLocation, useParams } from "react-router";
|
||||||
|
|
||||||
@@ -30,12 +30,12 @@ export default function SearchPage() {
|
|||||||
} else if (location.pathname.startsWith("/author/")) {
|
} else if (location.pathname.startsWith("/author/")) {
|
||||||
action = `Author ${param.author}`;
|
action = `Author ${param.author}`;
|
||||||
}
|
}
|
||||||
const title = `${action} Page 1`;
|
const title = `${action} Page ${page}`;
|
||||||
setTitle(title);
|
setTitle(title);
|
||||||
}, [page, location, param, setTitle]);
|
}, [page, location, param, setTitle]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<Container>
|
||||||
<Grid my="md">
|
<Grid my="md">
|
||||||
{paragraphs.map((paragraph) => {
|
{paragraphs.map((paragraph) => {
|
||||||
return (
|
return (
|
||||||
@@ -46,6 +46,6 @@ export default function SearchPage() {
|
|||||||
})}
|
})}
|
||||||
</Grid>
|
</Grid>
|
||||||
<Group justify="center">{pagination}</Group>
|
<Group justify="center">{pagination}</Group>
|
||||||
</div>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/types/paragraph.d.ts
vendored
1
src/types/paragraph.d.ts
vendored
@@ -8,4 +8,5 @@ declare interface Paragraph {
|
|||||||
cover: string;
|
cover: string;
|
||||||
time: string;
|
time: string;
|
||||||
tags: string[];
|
tags: string[];
|
||||||
|
source_url?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user