diff --git a/src/application/i18n/messages/en.json b/src/application/i18n/messages/en.json index 3432eaef..ddabed61 100644 --- a/src/application/i18n/messages/en.json +++ b/src/application/i18n/messages/en.json @@ -13,7 +13,9 @@ "userSettings": { "title": "User Settings", "changeTheme": "Change theme", - "userEditorTools": "User editor tools" + "userEditorTools": "User editor tools", + "uninstallEditorTool": "Uninstall", + "toolUninstallConfirmation": "Do you really want to delete this tool?" }, "noteSettings": { "title": "Note Settings", diff --git a/src/domain/user.repository.interface.ts b/src/domain/user.repository.interface.ts index 026d1158..1bcf0928 100644 --- a/src/domain/user.repository.interface.ts +++ b/src/domain/user.repository.interface.ts @@ -31,7 +31,7 @@ export default interface UserRepositoryInterface { getUserEditorTools: () => EditorTool[]; /** - * Adds a tool to the user (marketplace mock) + * Adds a tool to the user * * @param id - tool id */ diff --git a/src/domain/user.service.ts b/src/domain/user.service.ts index 5bb6d064..5dc3765d 100644 --- a/src/domain/user.service.ts +++ b/src/domain/user.service.ts @@ -48,7 +48,7 @@ export default class UserService { } /** - * Adds a tool to the user (marketplace mock) + * Adds a tool to the user * * @param id - tool id */ diff --git a/src/presentation/pages/Settings.vue b/src/presentation/pages/Settings.vue index 700694f8..c429d68f 100644 --- a/src/presentation/pages/Settings.vue +++ b/src/presentation/pages/Settings.vue @@ -5,8 +5,13 @@ v-for="tool in userEditorTools" :key="tool.id" > -
  • +
  • {{ 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 { removeTool } = useUserSettings(); /** * Changing the title in the browser @@ -54,12 +61,29 @@ async function userLogout() { router.push({ path: '/' }); }); } + +/** + * Deletes tool from the user + * + * @param toolId - id of the tool + */ +async function uninstallClicked(toolId: string) { + if (window.confirm(t('userSettings.toolUninstallConfirmation'))) { + await removeTool(toolId); + } +} -