diff --git a/public/_locales/en/messages.json b/public/_locales/en/messages.json
index a17aa37..52a81a8 100644
--- a/public/_locales/en/messages.json
+++ b/public/_locales/en/messages.json
@@ -70,6 +70,9 @@
"ERROR_CAN_NOT_FIND_NOTE_TO_EDIT": {
"message": "Can't find note"
},
+ "EDIT_NOTE_SUCCESS": {
+ "message": "Your changes was succesfully saved"
+ },
"DELETE_NOTE": {
"message": "Delete note $noteText$",
"placeholders": {
@@ -79,6 +82,12 @@
}
}
},
+ "DELETE_NOTE_SUCCESS": {
+ "message": "Note was successfully deleted"
+ },
+ "ADD_NOTE_SUCCESS": {
+ "message": "Note was successfully added"
+ },
"ERROR_CAN_NOT_FIND_NOTE_TO_DELETE": {
"message": "Can't find note"
},
@@ -156,5 +165,20 @@
},
"TOAST_BUTTON_OPEN_DETAILS": {
"message": "Open details"
+ },
+ "ERROR_LIST_NO_ITEMS": {
+ "message": "No logs"
+ },
+ "FACING_PROBLEMS": {
+ "message": "Facing problems? Send logs to us"
+ },
+ "FACING_PROBLEMS_HELP": {
+ "message": "Ask for help"
+ },
+ "SETTINGS_OPEN": {
+ "message": "Settings"
+ },
+ "CLEAR": {
+ "message": "Clear"
}
}
\ No newline at end of file
diff --git a/src/__tests__/setupTests.ts b/src/__tests__/setupTests.ts
index 2215572..7cb7941 100644
--- a/src/__tests__/setupTests.ts
+++ b/src/__tests__/setupTests.ts
@@ -1,12 +1,3 @@
-import { vi } from 'vitest'
-
-import * as toastModule from '@popup/shared/ui/Toast'
-import { getErrorToastMock } from '@popup/shared/ui/Toast/helpers/__mock__/getErrorToast'
-import { addToastMock } from '@popup/shared/ui/Toast/model/__mock__/store'
-
import { chromeMock } from '@shared/shared/browser/__mocks__/chrome'
global.chrome = chromeMock
-
-vi.spyOn(toastModule, 'getErrorToast').mockImplementation(getErrorToastMock)
-vi.spyOn(toastModule, 'addToast').mockImplementation(addToastMock)
diff --git a/src/popup/app/Popup.tsx b/src/popup/app/Popup.tsx
index 66caaa0..c9c79cc 100644
--- a/src/popup/app/Popup.tsx
+++ b/src/popup/app/Popup.tsx
@@ -1,14 +1,14 @@
import { NoteList } from '@popup/widgets/note/NoteList'
import { Settings } from '@popup/widgets/settings'
-import { Toasts } from '@popup/shared/ui/Toast'
+import { ErrorAlert } from '@popup/entities/error'
export const Popup = () => {
return (
+
-
)
}
diff --git a/src/popup/app/styles.scss b/src/popup/app/styles.scss
index 08a484d..af73885 100644
--- a/src/popup/app/styles.scss
+++ b/src/popup/app/styles.scss
@@ -96,17 +96,28 @@ h2 {
main {
width: 320px;
height: 480px;
+ padding: var(--spacing-5) var(--spacing-2);
+ overflow-y: auto;
+ scrollbar-gutter: stable both-edges;
+}
+
+ul {
+ list-style: none;
+}
+
+.settings-opener {
+ margin-inline: auto 0;
+ margin-bottom: var(--spacing-2);
}
.form {
- &__title {
- margin-bottom: var(--spacing-2);
- }
+ display: flex;
+ flex-direction: column;
+ gap: var(--spacing-2);
&__footer {
display: flex;
gap: var(--spacing-2);
justify-content: flex-end;
- margin-top: var(--spacing-2);
}
}
diff --git a/src/popup/entities/error/ui/ErrorAlert/index.tsx b/src/popup/entities/error/ui/ErrorAlert/index.tsx
new file mode 100644
index 0000000..6662990
--- /dev/null
+++ b/src/popup/entities/error/ui/ErrorAlert/index.tsx
@@ -0,0 +1,20 @@
+import { useStore } from '@nanostores/preact'
+
+import { browser } from '@popup/shared/browser'
+
+import { $errors } from '@shared/entities/error'
+
+export const ErrorAlert = () => {
+ const errors = useStore($errors)
+
+ if (!errors.length) return null
+
+ return (
+
+ {browser.i18n.getMessage('FACING_PROBLEMS')}
+
+ {browser.i18n.getMessage('FACING_PROBLEMS_HELP')}
+
+
+ )
+}
diff --git a/src/popup/entities/error/ui/ErrorCard/index.tsx b/src/popup/entities/error/ui/ErrorCard/index.tsx
deleted file mode 100644
index 50cde95..0000000
--- a/src/popup/entities/error/ui/ErrorCard/index.tsx
+++ /dev/null
@@ -1,13 +0,0 @@
-import { TBaseError } from '@shared/shared/libs/operationResult'
-
-interface Props {
- error: TBaseError
-}
-
-export const ErrorCard = ({ error }: Props) => {
- return (
-
- {error.type} {error.error}
-
- )
-}
diff --git a/src/popup/entities/error/ui/ErrorList/index.tsx b/src/popup/entities/error/ui/ErrorList/index.tsx
index fefbed7..59c84f7 100644
--- a/src/popup/entities/error/ui/ErrorList/index.tsx
+++ b/src/popup/entities/error/ui/ErrorList/index.tsx
@@ -1,19 +1,37 @@
import { useStore } from '@nanostores/preact'
-import { $errors } from '@shared/entities/error'
+import { browser } from '@popup/shared/browser'
+import { Button } from '@popup/shared/ui/Button'
-import { ErrorCard } from '../ErrorCard'
+import { $errors, reset } from '@shared/entities/error'
+
+import styles from './styles.module.scss'
export const ErrorList = () => {
const errors = useStore($errors)
+ if (!errors.length)
+ return {browser.i18n.getMessage('ERROR_LIST_NO_ITEMS')}
+
return (
-
- -
- {errors.map((error) => (
-
+ <>
+
+
+ {errors.map((error, index) => (
+ -
+ {error.type}
+ {error.error?.name}
+ {error.error?.message}
+ {error.error?.stack}
+
))}
-
-
+
+ >
)
}
diff --git a/src/popup/entities/error/ui/ErrorList/styles.module.scss b/src/popup/entities/error/ui/ErrorList/styles.module.scss
new file mode 100644
index 0000000..d6d8e36
--- /dev/null
+++ b/src/popup/entities/error/ui/ErrorList/styles.module.scss
@@ -0,0 +1,11 @@
+.errors {
+ display: flex;
+ flex-direction: column;
+ gap: var(--spacing-2);
+ overflow-wrap: break-word;
+}
+
+.clear-button {
+ margin-inline: auto 0;
+ margin-bottom: var(--spacing-2);
+}
diff --git a/src/popup/entities/error/ui/index.ts b/src/popup/entities/error/ui/index.ts
index 0acb133..b788225 100644
--- a/src/popup/entities/error/ui/index.ts
+++ b/src/popup/entities/error/ui/index.ts
@@ -1 +1,2 @@
export { ErrorList } from './ErrorList'
+export { ErrorAlert } from './ErrorAlert'
diff --git a/src/popup/entities/note/ui/NoteCard/styles.module.scss b/src/popup/entities/note/ui/NoteCard/styles.module.scss
index 1ae9ec3..7c50b48 100644
--- a/src/popup/entities/note/ui/NoteCard/styles.module.scss
+++ b/src/popup/entities/note/ui/NoteCard/styles.module.scss
@@ -3,7 +3,7 @@
grid-template-columns: 1fr auto;
gap: var(--spacing-2);
justify-content: space-between;
- padding: var(--spacing-4);
+ padding: var(--spacing-1);
border-bottom: 1px solid var(--color-neutral-200);
&__content {
diff --git a/src/popup/entities/tab/index.ts b/src/popup/entities/tab/index.ts
index c7073cb..debb5fb 100644
--- a/src/popup/entities/tab/index.ts
+++ b/src/popup/entities/tab/index.ts
@@ -1,7 +1,6 @@
import { atom, onMount, task } from 'nanostores'
import { browser } from '@popup/shared/browser'
-import { addToast, getErrorToast } from '@popup/shared/ui/Toast'
import { TTab } from '@shared/shared/browser/tabs'
@@ -11,10 +10,6 @@ onMount($activeTab, () => {
task(async () => {
const getResult = await browser.tabs.getActiveTab()
- if (getResult.data) {
- $activeTab.set(getResult.data)
- } else {
- addToast(getErrorToast(getResult.error))
- }
+ getResult.data && $activeTab.set(getResult.data)
})
})
diff --git a/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryList.tsx b/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryList.tsx
index 04d61df..968a213 100644
--- a/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryList.tsx
+++ b/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryList.tsx
@@ -24,6 +24,7 @@ export const SelectDictionaryList = () => {
{languages.map((language) => (
@@ -34,6 +35,7 @@ export const SelectDictionaryList = () => {
{languages.map((language) => {
return (
diff --git a/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryVariant.tsx b/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryVariant.tsx
index b85dc8e..08cecdb 100644
--- a/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryVariant.tsx
+++ b/src/popup/features/dictionary/SelectDictionaryVariant/ui/SelectDictionaryVariant.tsx
@@ -2,7 +2,6 @@ import { DictionaryCard } from '@popup/entities/dictionary'
import { browser } from '@popup/shared/browser'
import { Button } from '@popup/shared/ui/Button'
-import { addToast } from '@popup/shared/ui/Toast'
import {
IDictionaryWithVariants,
@@ -18,14 +17,8 @@ interface GroupProps {
}
export const SelectDictionaryVariant = ({ dictionary, lang }: GroupProps) => {
- const onSelectVariant = async (variant: string) => {
- const result = await dictionaryStore.selectVariant(
- lang,
- dictionary.id,
- variant,
- )
-
- result.error && addToast({ title: result.error.type, type: 'error' })
+ const onSelectVariant = (variant: string) => {
+ dictionaryStore.selectVariant(lang, dictionary.id, variant)
}
return (
diff --git a/src/popup/features/language/SelectLanguages/ui/SelectLanguages.tsx b/src/popup/features/language/SelectLanguages/ui/SelectLanguages.tsx
index 6d4b80f..32766e6 100644
--- a/src/popup/features/language/SelectLanguages/ui/SelectLanguages.tsx
+++ b/src/popup/features/language/SelectLanguages/ui/SelectLanguages.tsx
@@ -1,12 +1,15 @@
import { useStore } from '@nanostores/preact'
import { JSXInternal } from 'node_modules/preact/src/jsx'
+import { useState } from 'preact/hooks'
import { browser } from '@popup/shared/browser'
import { Button } from '@popup/shared/ui/Button'
-import { addToast, getErrorToast } from '@popup/shared/ui/Toast'
+import { Result } from '@popup/shared/ui/Result'
import { ILanguage } from '@shared/entities/language'
+import { TResult } from '@shared/shared/libs/operationResult'
+
import {
checkIsSelected,
localStore,
@@ -20,6 +23,7 @@ interface Props {
}
export const SelectLanguages = ({ languages }: Props) => {
+ const [result, setResult] = useState(null)
useStore(localStore.languageCodes)
const onSubmit: JSXInternal.SubmitEventHandler = async (
@@ -27,21 +31,17 @@ export const SelectLanguages = ({ languages }: Props) => {
) => {
e.preventDefault()
const result = await syncLocalStoreWithLanguageStore()
- result.data &&
- addToast({
- type: 'success',
- title: result.data,
- })
- result.error && addToast(getErrorToast(result.error))
+ setResult(result)
}
return (