diff --git a/.eslintrc.js b/.eslintrc.js
index 6b46108b..4b07ff99 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -27,7 +27,6 @@ module.exports = {
// 'plugin:@typescript-eslint/recommended-requiring-type-checking'
],
rules: {
- 'no-nested-ternary': 'off',
'@typescript-eslint/no-unused-vars': [
'warn',
{
@@ -35,8 +34,9 @@ module.exports = {
varsIgnorePattern: '^log$'
}
],
- '@typescript-eslint/no-explicit-any': 'warn',
- '@typescript-eslint/no-non-null-assertion': 'warn',
+ // TODO: Remove any usage and enable
+ '@typescript-eslint/no-explicit-any': 'off',
+ '@typescript-eslint/no-non-null-assertion': 'error',
// solid-js fix
'import/no-unresolved': [2, { ignore: ['solid-js/'] }]
diff --git a/.lintstagedrc b/.lintstagedrc
index 6de8a64b..cbb4bad9 100644
--- a/.lintstagedrc
+++ b/.lintstagedrc
@@ -1,6 +1,4 @@
{
"*.{js,ts,tsx,json,scss,css,html}": "prettier --write",
- "package.json": "sort-package-json",
- "*.{scss,css}": "stylelint",
- "*.{ts,tsx,js}": "eslint --fix"
+ "package.json": "sort-package-json"
}
diff --git a/.lintstagedrc.bak b/.lintstagedrc.bak
new file mode 100644
index 00000000..6de8a64b
--- /dev/null
+++ b/.lintstagedrc.bak
@@ -0,0 +1,6 @@
+{
+ "*.{js,ts,tsx,json,scss,css,html}": "prettier --write",
+ "package.json": "sort-package-json",
+ "*.{scss,css}": "stylelint",
+ "*.{ts,tsx,js}": "eslint --fix"
+}
diff --git a/package.json b/package.json
index 062fe454..e0ec6786 100644
--- a/package.json
+++ b/package.json
@@ -17,9 +17,9 @@
"lint:code:fix": "eslint . --fix",
"lint:styles": "stylelint **/*.{scss,css}",
"lint:styles:fix": "stylelint **/*.{scss,css} --fix",
- "pre-commit": "",
- "pre-push": "",
+ "pre-commit": "lint-staged",
"pre-commit-old": "lint-staged",
+ "pre-push": "",
"pre-push-old": "npm run typecheck",
"prepare": "husky install",
"preview": "astro preview",
@@ -30,7 +30,7 @@
"vercel-build": "astro build"
},
"dependencies": {
- "aws-sdk": "^2.0.0",
+ "@aws-sdk/client-s3": "^3.178.0",
"mailgun.js": "^8.0.1"
},
"devDependencies": {
@@ -60,17 +60,17 @@
"@urql/devtools": "^2.0.3",
"@urql/exchange-auth": "^1.0.0",
"@urql/exchange-graphcache": "^5.0.0",
- "astro": "^1.4.6",
- "astro-eslint-parser": "^0.7.3",
+ "astro": "^1.1.1",
+ "astro-eslint-parser": "^0.9.0",
"bcryptjs": "^2.4.3",
"bootstrap": "5.1.3",
"clsx": "^1.2.1",
"cookie": "^0.5.0",
"cookie-signature": "^1.2.0",
- "eslint": "^8.22.0",
+ "eslint": "^8.26.0",
"eslint-config-stylelint": "^17.0.0",
"eslint-import-resolver-typescript": "^3.5.0",
- "eslint-plugin-astro": "^0.20.0",
+ "eslint-plugin-astro": "^0.21.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-promise": "^6.0.1",
@@ -85,6 +85,8 @@
"idb": "^7.1.0",
"jest": "^29.2.1",
"lint-staged": "^13.0.3",
+ "loglevel": "^1.8.0",
+ "loglevel-plugin-prefix": "^0.8.4",
"markdown-it": "^13.0.1",
"markdown-it-container": "^3.0.0",
"markdown-it-implicit-figures": "^0.10.0",
@@ -123,7 +125,7 @@
"stylelint": "^14.12.1",
"stylelint-config-css-modules": "^4.1.0",
"stylelint-config-prettier-scss": "^0.0.1",
- "stylelint-config-standard-scss": "^5.0.0",
+ "stylelint-config-standard-scss": "^6.0.0",
"stylelint-order": "^5.0.0",
"stylelint-scss": "^4.3.0",
"swiper": "^8.4.2",
diff --git a/src/components/Article/Comment.tsx b/src/components/Article/Comment.tsx
index 102cba7c..ea40a630 100644
--- a/src/components/Article/Comment.tsx
+++ b/src/components/Article/Comment.tsx
@@ -1,10 +1,9 @@
import './Comment.scss'
import { Icon } from '../Nav/Icon'
import { AuthorCard } from '../Author/Card'
-import { Show } from 'solid-js/web'
+import { Show, createMemo } from 'solid-js'
import { clsx } from 'clsx'
import type { Author, Reaction as Point } from '../../graphql/types.gen'
-import { createMemo } from 'solid-js'
import { t } from '../../utils/intl'
// import { createReaction, updateReaction, deleteReaction } from '../../stores/zine/reactions'
import MD from './MD'
diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx
index 512cdac9..ab6d6b07 100644
--- a/src/components/Article/FullArticle.tsx
+++ b/src/components/Article/FullArticle.tsx
@@ -10,6 +10,7 @@ import { showModal } from '../../stores/ui'
import { useAuthStore } from '../../stores/auth'
import { incrementView } from '../../stores/zine/articles'
import MD from './MD'
+import { SharePopup } from './SharePopup'
const MAX_COMMENT_LEVEL = 6
@@ -126,9 +127,13 @@ export const FullArticle = (props: ArticleProps) => {
{/* */}
{/**/}
{/*FIXME*/}
{/**/}
diff --git a/src/components/Article/SharePopup.tsx b/src/components/Article/SharePopup.tsx
new file mode 100644
index 00000000..851cf599
--- /dev/null
+++ b/src/components/Article/SharePopup.tsx
@@ -0,0 +1,45 @@
+import { Icon } from '../Nav/Icon'
+import styles from '../Nav/Popup.module.scss'
+import { t } from '../../utils/intl'
+import { Popup, PopupProps } from '../Nav/Popup'
+
+type SharePopupProps = Omit
+
+export const SharePopup = (props: SharePopupProps) => {
+ return (
+
+
+
+ )
+}
diff --git a/src/components/Author/Card.tsx b/src/components/Author/Card.tsx
index b4d3c735..28acb21c 100644
--- a/src/components/Author/Card.tsx
+++ b/src/components/Author/Card.tsx
@@ -1,9 +1,8 @@
-import { For, Show } from 'solid-js/web'
import type { Author } from '../../graphql/types.gen'
import Userpic from './Userpic'
import { Icon } from '../Nav/Icon'
import style from './Card.module.scss'
-import { createMemo } from 'solid-js'
+import { createMemo, For, Show } from 'solid-js'
import { translit } from '../../utils/ru2en'
import { t } from '../../utils/intl'
import { useAuthStore } from '../../stores/auth'
diff --git a/src/components/Author/Full.tsx b/src/components/Author/Full.tsx
index 9f869f7e..b83ed413 100644
--- a/src/components/Author/Full.tsx
+++ b/src/components/Author/Full.tsx
@@ -2,7 +2,7 @@ import type { Author } from '../../graphql/types.gen'
import { AuthorCard } from './Card'
import './Full.scss'
-export default (props: { author: Author }) => {
+export const AuthorFull = (props: { author: Author }) => {
return (
diff --git a/src/components/Author/Userpic.tsx b/src/components/Author/Userpic.tsx
index 0a075738..0ed8744a 100644
--- a/src/components/Author/Userpic.tsx
+++ b/src/components/Author/Userpic.tsx
@@ -1,11 +1,13 @@
-import { Show } from 'solid-js/web'
+import { Show } from 'solid-js'
import type { Author } from '../../graphql/types.gen'
import style from './Userpic.module.scss'
+import { clsx } from 'clsx'
interface UserpicProps {
user: Author
hasLink?: boolean
isBig?: boolean
+ class?: string
}
export default (props: UserpicProps) => {
@@ -16,7 +18,7 @@ export default (props: UserpicProps) => {
}
return (
-
+
{
return (
diff --git a/src/components/Discours/Footer.tsx b/src/components/Discours/Footer.tsx
index ed0a50f7..941c5d3a 100644
--- a/src/components/Discours/Footer.tsx
+++ b/src/components/Discours/Footer.tsx
@@ -4,7 +4,7 @@ import { Icon } from '../Nav/Icon'
import Subscribe from './Subscribe'
import { t } from '../../utils/intl'
import { locale } from '../../stores/ui'
-import {clsx} from "clsx";
+import { clsx } from 'clsx'
export const Footer = () => {
const locale_title = createMemo(() => (locale() === 'ru' ? 'English' : 'Русский'))
diff --git a/src/components/Editor/components/Editor.module.scss b/src/components/Editor/components/Editor.module.scss
new file mode 100644
index 00000000..894a9dea
--- /dev/null
+++ b/src/components/Editor/components/Editor.module.scss
@@ -0,0 +1,7 @@
+.error {
+ display: none;
+}
+
+.markdown {
+ white-space: pre-wrap;
+}
diff --git a/src/components/Editor/components/Editor.tsx b/src/components/Editor/components/Editor.tsx
index b2ee8aca..3bdcbf3d 100644
--- a/src/components/Editor/components/Editor.tsx
+++ b/src/components/Editor/components/Editor.tsx
@@ -3,18 +3,21 @@ import type { EditorState } from 'prosemirror-state'
import { useState } from '../store/context'
import { ProseMirror } from './ProseMirror'
import '../styles/Editor.scss'
+import styles from './Editor.module.scss'
+import { clsx } from 'clsx'
export const Editor = () => {
const [store, ctrl] = useState()
const onInit = (text: EditorState, editorView: EditorView) => ctrl.setState({ editorView, text })
const onReconfigure = (text: EditorState) => ctrl.setState({ text })
const onChange = (text: EditorState) => ctrl.setState({ text, lastModified: new Date() })
- // const editorCss = (config) => css``
- const style = () => (store.error ? `display: none;` : (store.markdown ? `white-space: pre-wrap;` : ''))
+
return (
{
return (
}>
-
+
-
+
-
+
)
@@ -24,8 +24,8 @@ const InvalidState = (props: { title: string }) => {
const onClick = () => ctrl.clean()
return (
-
-
+
+
{props.title}
There is an error with the editor state. This is probably due to an old version in which the data
@@ -35,7 +35,7 @@ const InvalidState = (props: { title: string }) => {
{JSON.stringify(store.error.props)}
-
@@ -53,13 +53,13 @@ const Other = () => {
}
return (
-
-
+
+
An error occurred.
{getMessage()}
-
+
Close
diff --git a/src/components/Editor/components/Layout.tsx b/src/components/Editor/components/Layout.tsx
index 2d9a35e0..eeea10a8 100644
--- a/src/components/Editor/components/Layout.tsx
+++ b/src/components/Editor/components/Layout.tsx
@@ -1,17 +1,19 @@
-import type { JSX } from 'solid-js/jsx-runtime';
+import type { JSX } from 'solid-js/jsx-runtime'
import type { Config } from '../store/context'
import '../styles/Layout.scss'
export type Styled = {
- children: JSX.Element;
- config?: Config;
- 'data-testid'?: string;
- onClick?: () => void;
- onMouseEnter?: (e: MouseEvent) => void;
+ children: JSX.Element
+ config?: Config
+ 'data-testid'?: string
+ onClick?: () => void
+ onMouseEnter?: (e: MouseEvent) => void
}
export const Layout = (props: Styled) => {
- return (
- {props.children}
-
)
+ return (
+
+ {props.children}
+
+ )
}
diff --git a/src/components/Editor/components/ProseMirror.tsx b/src/components/Editor/components/ProseMirror.tsx
index da06ba55..1f1c9a86 100644
--- a/src/components/Editor/components/ProseMirror.tsx
+++ b/src/components/Editor/components/ProseMirror.tsx
@@ -6,14 +6,13 @@ import { Schema } from 'prosemirror-model'
import type { NodeViewFn, ProseMirrorExtension, ProseMirrorState } from '../prosemirror/helpers'
interface ProseMirrorProps {
- style?: string;
- className?: string;
- text?: Store
;
- editorView?: Store;
- extensions?: Store;
- onInit: (s: EditorState, v: EditorView) => void;
- onReconfigure: (s: EditorState) => void;
- onChange: (s: EditorState) => void;
+ cssClass?: string
+ text?: Store
+ editorView?: Store
+ extensions?: Store
+ onInit: (s: EditorState, v: EditorView) => void
+ onReconfigure: (s: EditorState) => void
+ onChange: (s: EditorState) => void
}
export const ProseMirror = (props: ProseMirrorProps) => {
@@ -28,45 +27,39 @@ export const ProseMirror = (props: ProseMirrorProps) => {
props.onChange(newState)
}
- createEffect((payload: [EditorState, ProseMirrorExtension[]]) => {
- const [prevText, prevExtensions] = payload
- const text = unwrap(props.text)
- const extensions: ProseMirrorExtension[] = unwrap(props.extensions)
- if (!text || !extensions?.length) {
+ createEffect(
+ (payload: [EditorState, ProseMirrorExtension[]]) => {
+ const [prevText, prevExtensions] = payload
+ const text = unwrap(props.text)
+ const extensions: ProseMirrorExtension[] = unwrap(props.extensions)
+ if (!text || !extensions?.length) {
+ return [text, extensions]
+ }
+
+ if (!props.editorView) {
+ const { editorState, nodeViews } = createEditorState(text, extensions)
+ const view = new EditorView(editorRef, { state: editorState, nodeViews, dispatchTransaction })
+ view.focus()
+ props.onInit(editorState, view)
+ return [editorState, extensions]
+ }
+
+ if (extensions !== prevExtensions || (!(text instanceof EditorState) && text !== prevText)) {
+ const { editorState, nodeViews } = createEditorState(text, extensions, prevText)
+ if (!editorState) return
+ editorView().updateState(editorState)
+ editorView().setProps({ nodeViews, dispatchTransaction })
+ props.onReconfigure(editorState)
+ editorView().focus()
+ return [editorState, extensions]
+ }
+
return [text, extensions]
- }
-
- if (!props.editorView) {
- const { editorState, nodeViews } = createEditorState(text, extensions)
- const view = new EditorView(editorRef, { state: editorState, nodeViews, dispatchTransaction })
- view.focus()
- props.onInit(editorState, view)
- return [editorState, extensions]
- }
-
- if (extensions !== prevExtensions || (!(text instanceof EditorState) && text !== prevText)) {
- const { editorState, nodeViews } = createEditorState(text, extensions, prevText)
- if (!editorState) return
- editorView().updateState(editorState)
- editorView().setProps({ nodeViews, dispatchTransaction })
- props.onReconfigure(editorState)
- editorView().focus()
- return [editorState, extensions]
- }
-
- return [text, extensions]
- },
- [props.text, props.extensions]
+ },
+ [props.text, props.extensions]
)
- return (
-
- )
+ return
}
const createEditorState = (
@@ -74,8 +67,8 @@ const createEditorState = (
extensions: ProseMirrorExtension[],
prevText?: EditorState
): {
- editorState: EditorState;
- nodeViews: { [key: string]: NodeViewFn };
+ editorState: EditorState
+ nodeViews: { [key: string]: NodeViewFn }
} => {
const reconfigure = text instanceof EditorState && prevText?.schema
let schemaSpec = { nodes: {} }
@@ -104,7 +97,7 @@ const createEditorState = (
editorState = text.reconfigure({ schema, plugins } as EditorStateConfig)
} else if (text instanceof EditorState) {
editorState = EditorState.fromJSON({ schema, plugins }, text.toJSON())
- } else if (text){
+ } else if (text) {
console.debug(text)
editorState = EditorState.fromJSON({ schema, plugins }, text)
}
diff --git a/src/components/Editor/components/Sidebar.module.scss b/src/components/Editor/components/Sidebar.module.scss
new file mode 100644
index 00000000..a626b942
--- /dev/null
+++ b/src/components/Editor/components/Sidebar.module.scss
@@ -0,0 +1,3 @@
+.withMargin {
+ margin-bottom: 10px;
+}
diff --git a/src/components/Editor/components/Sidebar.tsx b/src/components/Editor/components/Sidebar.tsx
index ecb392c1..f7fb7415 100644
--- a/src/components/Editor/components/Sidebar.tsx
+++ b/src/components/Editor/components/Sidebar.tsx
@@ -7,17 +7,20 @@ import * as remote from '../remote'
import { isEmpty } from '../prosemirror/helpers'
import type { Styled } from './Layout'
import '../styles/Sidebar.scss'
+import { clsx } from 'clsx'
+import styles from './Sidebar.module.scss'
-const Off = (props) =>
+const Off = (props) =>
-const Label = (props: Styled) =>
+const Label = (props: Styled) =>
const Link = (
props: Styled & { withMargin?: boolean; disabled?: boolean; title?: string; className?: string }
) => (