From 0421134c139363fe901827d1b4594cb9af8dc333 Mon Sep 17 00:00:00 2001 From: e11sy Date: Fri, 23 Feb 2024 16:23:41 +0300 Subject: [PATCH 01/11] delete editor tools from user settings - added ability to delete not default tools from user settings --- src/application/services/useUserSettings.ts | 2 +- src/domain/user.service.ts | 9 +++++++++ src/presentation/pages/Settings.vue | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/application/services/useUserSettings.ts b/src/application/services/useUserSettings.ts index 031ba39c..026ccad5 100644 --- a/src/application/services/useUserSettings.ts +++ b/src/application/services/useUserSettings.ts @@ -18,7 +18,7 @@ interface UseUserSettingsComposableState { /** * Methods for working with user settings */ -export function useUserSettings(): UseUserSettingsComposableState { +export default function useUserSettings(): UseUserSettingsComposableState { /** * Add tool to the user settings * diff --git a/src/domain/user.service.ts b/src/domain/user.service.ts index 5bb6d064..4323f49a 100644 --- a/src/domain/user.service.ts +++ b/src/domain/user.service.ts @@ -64,4 +64,13 @@ export default class UserService { public async removeTool(id: string): Promise { return await this.repository.removeTool(id); } + + /** + * Deletes a tool from the user (marketplace mock) + * + * @param id - tool id + */ + public deleteTool(id: string): void { + this.repository.deleteTool(id); + } } diff --git a/src/presentation/pages/Settings.vue b/src/presentation/pages/Settings.vue index 700694f8..80548709 100644 --- a/src/presentation/pages/Settings.vue +++ b/src/presentation/pages/Settings.vue @@ -7,6 +7,11 @@ >
  • {{ tool.title }} +
  • @@ -31,6 +36,7 @@ import Button from '../components/button/Button.vue'; import { IconUnlink } from '@codexteam/icons'; import { useRouter } from 'vue-router'; import useAuth from '@/application/services/useAuth'; +import useUserSettings from '@/application/services/useUserSettings'; import ThemeButton from '@/presentation/components/theme/ThemeButton.vue'; import { useAppState } from '@/application/services/useAppState'; import { useHead } from 'unhead'; @@ -39,6 +45,7 @@ const { userEditorTools } = useAppState(); const { t } = useI18n(); const router = useRouter(); const { logout } = useAuth(); +const { deleteTool } = useUserSettings(); /** * Changing the title in the browser @@ -54,6 +61,15 @@ async function userLogout() { router.push({ path: '/' }); }); } + +/** + * Deletes tool from the user + * + * @param toolId - id of the tool + */ +async function userDeleteTool(toolId) { + await deleteTool(toolId); +} From 1df052125abc5323b5159bc1d2e0ddabf8541b1b Mon Sep 17 00:00:00 2001 From: e11sy Date: Sun, 25 Feb 2024 17:58:35 +0300 Subject: [PATCH 07/11] changed dict --- src/application/i18n/messages/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/application/i18n/messages/en.json b/src/application/i18n/messages/en.json index 515754f0..266fd91a 100644 --- a/src/application/i18n/messages/en.json +++ b/src/application/i18n/messages/en.json @@ -14,7 +14,7 @@ "title": "User Settings", "changeTheme": "Change theme", "userEditorTools": "User editor tools", - "deleteEditorTool": "Uninstall" + "uninstallEditorTool": "Uninstall" }, "noteSettings": { "title": "Note Settings", From 1a866c018ac68097f25757d425b83ae4c2a4f2d2 Mon Sep 17 00:00:00 2001 From: e11sy Date: Sun, 25 Feb 2024 18:06:30 +0300 Subject: [PATCH 08/11] added delete editorTool confirmation --- src/presentation/pages/Settings.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/presentation/pages/Settings.vue b/src/presentation/pages/Settings.vue index 2525d8e3..c9165b46 100644 --- a/src/presentation/pages/Settings.vue +++ b/src/presentation/pages/Settings.vue @@ -9,8 +9,8 @@ {{ tool.title }}