split thunks from slices to avoid circular dependencies

This commit is contained in:
Athou
2023-12-28 22:11:03 +01:00
parent bb4bb0c7d7
commit 0ea0db48db
41 changed files with 460 additions and 413 deletions

View File

@@ -2,7 +2,7 @@ import { Trans } from "@lingui/macro"
import { Box, Button, Group, Stack } from "@mantine/core"
import { useForm } from "@mantine/form"
import { client, errorToStrings } from "app/client"
import { redirectToSelectedSource } from "app/slices/redirect"
import { redirectToSelectedSource } from "app/redirect/thunks"
import { useAppDispatch, useAppSelector } from "app/store"
import { Alert } from "components/Alert"
import { CodeEditor } from "components/code/CodeEditor"

View File

@@ -1,6 +1,8 @@
import { Trans } from "@lingui/macro"
import { Divider, Select, SimpleGrid, Stack, Switch } from "@mantine/core"
import { Constants } from "app/constants"
import { useAppDispatch, useAppSelector } from "app/store"
import { type SharingSettings } from "app/types"
import {
changeAlwaysScrollToEntry,
changeCustomContextMenu,
@@ -10,9 +12,7 @@ import {
changeScrollSpeed,
changeSharingSetting,
changeShowRead,
} from "app/slices/user"
import { useAppDispatch, useAppSelector } from "app/store"
import { type SharingSettings } from "app/types"
} from "app/user/thunks"
import { locales } from "i18n"
export function DisplaySettings() {
@@ -82,7 +82,14 @@ export function DisplaySettings() {
key={site}
label={Constants.sharing[site].label}
checked={sharingSettings && sharingSettings[site]}
onChange={async e => await dispatch(changeSharingSetting({ site, value: e.currentTarget.checked }))}
onChange={async e =>
await dispatch(
changeSharingSetting({
site,
value: e.currentTarget.checked,
})
)
}
/>
))}
</SimpleGrid>

View File

@@ -3,10 +3,10 @@ import { Anchor, Box, Button, Checkbox, Divider, Group, Input, PasswordInput, St
import { useForm } from "@mantine/form"
import { openConfirmModal } from "@mantine/modals"
import { client, errorToStrings } from "app/client"
import { redirectToLogin, redirectToSelectedSource } from "app/slices/redirect"
import { reloadProfile } from "app/slices/user"
import { redirectToLogin, redirectToSelectedSource } from "app/redirect/thunks"
import { useAppDispatch, useAppSelector } from "app/store"
import { type ProfileModificationRequest } from "app/types"
import { reloadProfile } from "app/user/thunks"
import { Alert } from "components/Alert"
import { useEffect } from "react"
import { useAsyncCallback } from "react-async-hook"