Collection of handy online tools for developers, with great UX.
TypeScript converterdeveloper-productivitydeveloper-toolsfrontendjavascriptproductivitytooltoolstypescriptvuejswebsite
feat(favorites) drag-and-drop favorites section (#1360)
gitmotion0b1b98f93ea1
diff --git a/locales/de.yml b/locales/de.ymlindex 1186332f..e4f5da64 100644--- a/locales/de.yml+++ b/locales/de.yml@@ -10,6 +10,7 @@ home:newestTools: Neueste ToolsfavoriteTools: Deine LieblingstoolsallTools: Alle Tools+ favoritesDndToolTip: 'Ziehen und Ablegen, um Favoriten neu zu ordnen'subtitle: Praktische Tools für EntwicklertoggleMenu: Menü umschaltenhome: Startseitediff --git a/locales/en.yml b/locales/en.ymlindex 9f54a259..b195dbd8 100644--- a/locales/en.yml+++ b/locales/en.yml@@ -3,6 +3,7 @@ home:newestTools: Newest toolsfavoriteTools: 'Your favorite tools'allTools: 'All the tools'+ favoritesDndToolTip: 'Drag and drop to reorder favorites'subtitle: 'Handy tools for developers'toggleMenu: 'Toggle menu'home: Homediff --git a/locales/es.yml b/locales/es.ymlindex bf631232..58e3444f 100644--- a/locales/es.yml+++ b/locales/es.yml@@ -3,6 +3,7 @@ home:newestTools: Nuevas herramientasfavoriteTools: 'Tus herramientas favoritas'allTools: 'Todas las herramientas'+ favoritesDndToolTip: 'Arrastra y suelta para reordenar favoritos'subtitle: 'Herramientas practicas para desarrolladores'toggleMenu: 'Toggle menu'home: Homediff --git a/locales/fr.yml b/locales/fr.ymlindex 3af9f36f..2e9bbace 100644--- a/locales/fr.yml+++ b/locales/fr.yml@@ -3,6 +3,7 @@ home:newestTools: 'Les nouveaux outils'favoriteTools: 'Vos outils favoris'allTools: 'Tous les outils'+ favoritesDndToolTip: 'Faites glisser et déposez pour réordonner vos favoris'subtitle: 'Outils pour les développeurs'toggleMenu: 'Menu'home: Accueildiff --git a/locales/no.yml b/locales/no.ymlindex 4aa06379..28f96bf2 100644--- a/locales/no.yml+++ b/locales/no.yml@@ -3,6 +3,7 @@ home:newestTools: Nyeste verktøyfavoriteTools: 'Dine favoritt verktøy'allTools: 'Alle verktøyene'+ favoritesDndToolTip: 'Dra og slipp for å omordne favoritter'subtitle: 'Nyttige verktøy for utviklere'toggleMenu: 'Vekslemenmy'home: Hjemdiff --git a/locales/pt.yml b/locales/pt.ymlindex a97cbe01..7e0ef024 100644--- a/locales/pt.yml+++ b/locales/pt.yml@@ -3,6 +3,7 @@ home:newestTools: 'Novas ferramentas'favoriteTools: 'Suas ferramentas favoritas'allTools: 'Todas as ferramentas'+ favoritesDndToolTip: 'Arraste e solte para reordenar favoritos'subtitle: 'Ferraentas úteis para desenvolvedores'toggleMenu: 'Menu'home: 'Início'diff --git a/locales/uk.yml b/locales/uk.ymlindex 744f5f99..3b66d2c4 100644--- a/locales/uk.yml+++ b/locales/uk.yml@@ -3,6 +3,7 @@ home:newestTools: Найновіші інструментиfavoriteTools: 'Ваші улюблені інструменти'allTools: 'Усі інструменти'+ favoritesDndToolTip: 'Перетягніть і відпустіть, щоб змінити порядок улюблених'subtitle: 'Зручні інструменти для розробників'toggleMenu: 'Перемикання меню'home: Головнаdiff --git a/locales/vi.yml b/locales/vi.ymlindex 87bfbb7a..a68017ca 100644--- a/locales/vi.yml+++ b/locales/vi.yml@@ -3,6 +3,7 @@ home:newestTools: Công cụ mới nhấtfavoriteTools: 'Công cụ yêu thích của bạn'allTools: 'Tất cả công cụ'+ favoritesDndToolTip: 'Kéo thả để sắp xếp lại yêu thích'subtitle: 'Công cụ cho nhà phát triển.'toggleMenu: 'Chuyển đổi menu'home: Trang chủdiff --git a/locales/zh.yml b/locales/zh.ymlindex aa0afda9..50dd626f 100644--- a/locales/zh.yml+++ b/locales/zh.yml@@ -3,6 +3,7 @@ home:newestTools: '最新工具'favoriteTools: '我的收藏'allTools: '全部工具'+ favoritesDndToolTip: '拖放重新排列收藏夹'subtitle: '助力开发人员和 IT 工作者'toggleMenu: '切换菜单'home: '主页'diff --git a/package.json b/package.jsonindex 65f23816..5c991cff 100644--- a/package.json+++ b/package.json@@ -99,6 +99,7 @@"vue-router": "^4.1.6","vue-shadow-dom": "^4.2.0","vue-tsc": "^1.8.1",+ "vuedraggable": "^4.1.0","xml-formatter": "^3.3.2","xml-js": "^1.6.11","yaml": "^2.2.1"diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 8a18a7c0..3798ae17 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -194,6 +194,9 @@ dependencies:vue-tsc:specifier: ^1.8.1version: 1.8.1([email protected])+ vuedraggable:+ specifier: ^4.1.0+ version: 4.1.0([email protected])xml-formatter:specifier: ^3.3.2version: 3.3.2@@ -8231,6 +8234,9 @@ packages:tslib: 2.5.0dev: false+ resolution: {integrity: sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==}+resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}engines: {node: '>=0.10.0'}@@ -9356,6 +9362,14 @@ packages:'@vue/server-renderer': 3.3.4([email protected])'@vue/shared': 3.3.4+ resolution: {integrity: sha512-FU5HCWBmsf20GpP3eudURW3WdWTKIbEIQxh9/8GE806hydR9qZqRRxRE3RjqX7PkuLuMQG/A7n3cfj9rCEchww==}+ peerDependencies:+ vue: ^3.0.1+ dependencies:+ sortablejs: 1.14.0+ vue: 3.3.4+resolution: {integrity: sha512-pLiMChM4f+W8czlIClGvGBYo656lc2Y0/mXFSCydcSmnCR1izlKPGMgiYBGjbY9FDkFG8a2HEVz7t0DNzBWbDw==}peerDependencies:diff --git a/src/pages/Home.page.vue b/src/pages/Home.page.vueindex f4fe0d1d..fdbccf7e 100644--- a/src/pages/Home.page.vue+++ b/src/pages/Home.page.vue@@ -1,6 +1,8 @@<script setup lang="ts">-import { IconHeart } from '@tabler/icons-vue';+import { IconDragDrop, IconHeart } from '@tabler/icons-vue';import { useHead } from '@vueuse/head';+import { computed } from 'vue';+import Draggable from 'vuedraggable';import ColoredCard from '../components/ColoredCard.vue';import ToolCard from '../components/ToolCard.vue';import { useToolStore } from '@/tools/tools.store';@@ -10,6 +12,13 @@ const toolStore = useToolStore();useHead({ title: 'IT Tools - Handy online tools for developers' });const { t } = useI18n();++const favoriteTools = computed(() => toolStore.favoriteTools);++// Update favorite tools order when drag is finished+function onUpdateFavoriteTools() {+ toolStore.updateFavoriteTools(favoriteTools.value); // Update the store with the new order+}</script><template>@@ -66,10 +75,21 @@ const { t } = useI18n();<div v-if="toolStore.favoriteTools.length > 0"><h3 class="mb-5px mt-25px font-500 text-neutral-400">{{ $t('home.categories.favoriteTools') }}+ <c-tooltip :tooltip="$t('home.categories.favoritesDndToolTip')">+ <n-icon :component="IconDragDrop" size="18" />+ </c-tooltip></h3>- <div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">- <ToolCard v-for="tool in toolStore.favoriteTools" :key="tool.name" :tool="tool" />- </div>+ <Draggable+ :list="favoriteTools"+ class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4"+ ghost-class="ghost-favorites-draggable"+ item-key="name"+ @end="onUpdateFavoriteTools"+ >+ <template #item="{ element: tool }">+ <ToolCard :tool="tool" />+ </template>+ </Draggable></div></transition>@@ -107,4 +127,24 @@ const { t } = useI18n();opacity: 0;margin-bottom: 0;}++.ghost-favorites-draggable {+ opacity: 0.4;+ background-color: #ccc;+ border: 2px dashed #666;+ box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);+ transform: scale(1.1);+ animation: ghost-favorites-draggable-animation 0.2s ease-out;+}++@keyframes ghost-favorites-draggable-animation {+ 0% {+ opacity: 0;+ transform: scale(0.9);+ }+ 100% {+ opacity: 0.4;+ transform: scale(1.0);+ }+}</style>diff --git a/src/tools/tools.store.ts b/src/tools/tools.store.tsindex 631390fe..fb12450d 100644--- a/src/tools/tools.store.ts+++ b/src/tools/tools.store.ts@@ -59,5 +59,9 @@ export const useToolStore = defineStore('tools', () => {return favoriteToolsName.value.includes(get(tool).name)|| favoriteToolsName.value.includes(get(tool).path);},++ updateFavoriteTools(newOrder: ToolWithCategory[]) {+ favoriteToolsName.value = newOrder.map(tool => tool.path);+ },};});