mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
added nextjs and fixed problems for it
This commit is contained in:
parent
37e0923bb1
commit
58fa40dd5c
10 changed files with 1083 additions and 103 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -2,3 +2,5 @@
|
||||||
/npm-debug.log
|
/npm-debug.log
|
||||||
/.idea
|
/.idea
|
||||||
/dist
|
/dist
|
||||||
|
/build
|
||||||
|
/.next
|
||||||
|
|
5
next-env.d.ts
vendored
Normal file
5
next-env.d.ts
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
|
@ -23,6 +23,7 @@
|
||||||
"marked": "^2.0.0",
|
"marked": "^2.0.0",
|
||||||
"mobx": "^6.3.10",
|
"mobx": "^6.3.10",
|
||||||
"mobx-react": "^7.2.1",
|
"mobx-react": "^7.2.1",
|
||||||
|
"next": "^12.0.7",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^4.14.1",
|
||||||
"photoswipe": "^4.1.3",
|
"photoswipe": "^4.1.3",
|
||||||
"raleway-cyrillic": "^4.0.2",
|
"raleway-cyrillic": "^4.0.2",
|
||||||
|
@ -86,9 +87,9 @@
|
||||||
"@types/throttle-debounce": "^2.1.0",
|
"@types/throttle-debounce": "^2.1.0",
|
||||||
"@types/yup": "^0.29.11",
|
"@types/yup": "^0.29.11",
|
||||||
"craco-alias": "^2.3.1",
|
"craco-alias": "^2.3.1",
|
||||||
|
"husky": "^7.0.4",
|
||||||
"lint-staged": "^12.1.6",
|
"lint-staged": "^12.1.6",
|
||||||
"prettier": "^1.18.2",
|
"prettier": "^1.18.2"
|
||||||
"husky": "^7.0.4"
|
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"./**/*.{js,jsx,ts,tsx}": [
|
"./**/*.{js,jsx,ts,tsx}": [
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import React, { FC, useCallback, useEffect } from "react";
|
import React, { FC, useCallback, useEffect } from 'react';
|
||||||
import { ButtonGroup } from "~/components/input/ButtonGroup";
|
import { ButtonGroup } from '~/components/input/ButtonGroup';
|
||||||
import { Button } from "~/components/input/Button";
|
import { Button } from '~/components/input/Button';
|
||||||
import { useFormatWrapper, wrapTextInsideInput } from "~/hooks/dom/useFormatWrapper";
|
import { useFormatWrapper, wrapTextInsideInput } from '~/hooks/dom/useFormatWrapper';
|
||||||
import styles from "./styles.module.scss";
|
import styles from './styles.module.scss';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
element: HTMLTextAreaElement;
|
element: HTMLTextAreaElement;
|
||||||
|
@ -10,10 +10,12 @@ interface IProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CommentFormFormatButtons: FC<IProps> = ({ element, handler }) => {
|
const CommentFormFormatButtons: FC<IProps> = ({ element, handler }) => {
|
||||||
const wrap = useCallback(
|
const wrapper = useFormatWrapper(handler);
|
||||||
(prefix = '', suffix = '') => useFormatWrapper(element, handler, prefix, suffix),
|
|
||||||
[element, handler]
|
const wrap = useCallback((prefix = '', suffix = '') => wrapper(element, prefix, suffix), [
|
||||||
);
|
element,
|
||||||
|
wrapper,
|
||||||
|
]);
|
||||||
|
|
||||||
const wrapBold = useCallback(
|
const wrapBold = useCallback(
|
||||||
event => {
|
event => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { DetailsHTMLAttributes, FC } from "react";
|
import React, { DetailsHTMLAttributes, FC } from 'react';
|
||||||
import StickyBox from "react-sticky-box/dist/esnext";
|
import StickyBox from 'react-sticky-box';
|
||||||
|
|
||||||
interface IProps extends DetailsHTMLAttributes<HTMLDivElement> {
|
interface IProps extends DetailsHTMLAttributes<HTMLDivElement> {
|
||||||
offsetTop?: number;
|
offsetTop?: number;
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
import React, { FC } from "react";
|
import React, { FC } from 'react';
|
||||||
import { NodeDeletedBadge } from "~/components/node/NodeDeletedBadge";
|
import { NodeDeletedBadge } from '~/components/node/NodeDeletedBadge';
|
||||||
import { Group } from "~/components/containers/Group";
|
import { Group } from '~/components/containers/Group';
|
||||||
import { Padder } from "~/components/containers/Padder";
|
import { Padder } from '~/components/containers/Padder';
|
||||||
import { NodeCommentForm } from "~/components/node/NodeCommentForm";
|
import { NodeCommentForm } from '~/components/node/NodeCommentForm';
|
||||||
import { NodeRelatedBlock } from "~/components/node/NodeRelatedBlock";
|
import { NodeRelatedBlock } from '~/components/node/NodeRelatedBlock';
|
||||||
import { useNodeBlocks } from "~/hooks/node/useNodeBlocks";
|
import { useNodeBlocks } from '~/hooks/node/useNodeBlocks';
|
||||||
import { NodeTagsBlock } from "~/components/node/NodeTagsBlock";
|
import { NodeTagsBlock } from '~/components/node/NodeTagsBlock';
|
||||||
import StickyBox from "react-sticky-box/dist/esnext";
|
import StickyBox from 'react-sticky-box';
|
||||||
import styles from "./styles.module.scss";
|
import styles from './styles.module.scss';
|
||||||
import { NodeAuthorBlock } from "~/components/node/NodeAuthorBlock";
|
import { NodeAuthorBlock } from '~/components/node/NodeAuthorBlock';
|
||||||
import { useNodeContext } from "~/utils/context/NodeContextProvider";
|
import { useNodeContext } from '~/utils/context/NodeContextProvider';
|
||||||
import { useCommentContext } from "~/utils/context/CommentContextProvider";
|
import { useCommentContext } from '~/utils/context/CommentContextProvider';
|
||||||
import { NodeNoComments } from "~/components/node/NodeNoComments";
|
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
||||||
import { NodeComments } from "~/containers/node/NodeComments";
|
import { NodeComments } from '~/containers/node/NodeComments';
|
||||||
import { useUserContext } from "~/utils/context/UserContextProvider";
|
import { useUserContext } from '~/utils/context/UserContextProvider';
|
||||||
import { useNodeRelatedContext } from "~/utils/context/NodeRelatedContextProvider";
|
import { useNodeRelatedContext } from '~/utils/context/NodeRelatedContextProvider';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
commentsOrder: 'ASC' | 'DESC';
|
commentsOrder: 'ASC' | 'DESC';
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
import { useCallback } from "react";
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
/** wraps text inside textarea with tags */
|
/** wraps text inside textarea with tags */
|
||||||
export const useFormatWrapper = (
|
export const useFormatWrapper = (onChange: (val: string) => void) => {
|
||||||
target: HTMLTextAreaElement,
|
|
||||||
onChange: (val: string) => void,
|
|
||||||
prefix = '',
|
|
||||||
suffix = ''
|
|
||||||
) => {
|
|
||||||
return useCallback(
|
return useCallback(
|
||||||
event => {
|
(
|
||||||
|
target: HTMLTextAreaElement,
|
||||||
|
|
||||||
|
prefix = '',
|
||||||
|
suffix = ''
|
||||||
|
) => event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
wrapTextInsideInput(target, prefix, suffix, onChange);
|
wrapTextInsideInput(target, prefix, suffix, onChange);
|
||||||
},
|
},
|
||||||
[target, onChange, prefix, suffix]
|
[onChange]
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { Group } from '~/components/containers/Group';
|
import { Group } from '~/components/containers/Group';
|
||||||
import { Container } from '~/containers/main/Container';
|
import { Container } from '~/containers/main/Container';
|
||||||
import StickyBox from 'react-sticky-box/dist/esnext';
|
import StickyBox from 'react-sticky-box';
|
||||||
import { BorisComments } from '~/containers/boris/BorisComments';
|
import { BorisComments } from '~/containers/boris/BorisComments';
|
||||||
import { Card } from '~/components/containers/Card';
|
import { Card } from '~/components/containers/Card';
|
||||||
import { SidebarRouter } from '~/containers/main/SidebarRouter';
|
import { SidebarRouter } from '~/containers/main/SidebarRouter';
|
||||||
|
|
|
@ -19,8 +19,9 @@
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react",
|
"jsx": "preserve",
|
||||||
"noImplicitAny": false
|
"noImplicitAny": false,
|
||||||
|
"incremental": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src"
|
"src"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue