From c2a6edc0e46b6bf8140d4762a814cc41a0aab67f Mon Sep 17 00:00:00 2001 From: mnenie <121057011+mneniee@users.noreply.github.com> Date: Mon, 15 Jul 2024 21:23:10 +0300 Subject: [PATCH] add: resizeble panels, fix: search, refactoring --- package.json | 1 + public/icons/arrow-back.svg | 1 + public/icons/arrows.svg | 1 + src/app/App.vue | 2 +- src/app/providers/router/index.ts | 6 +- src/app/styles/primary/exceptions.scss | 12 +++ .../filter/lib/composables/useFilter.ts | 40 +++++++++ src/features/filter/ui/SearchFilter.vue | 36 +++++++- src/features/plan/ui/PlanCard.vue | 47 ++++++++-- src/layouts/ui/SidebarLayout.vue | 45 ++++++++-- src/widgets/layout/ui/sidebar/Sidebar.vue | 90 ++++++++++++++++--- src/widgets/layout/ui/sidebar/WorkSpace.vue | 31 +++++-- yarn.lock | 25 +++++- 13 files changed, 294 insertions(+), 43 deletions(-) create mode 100644 public/icons/arrow-back.svg create mode 100644 public/icons/arrows.svg create mode 100644 src/features/filter/lib/composables/useFilter.ts diff --git a/package.json b/package.json index fb60b72..10e9bad 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "floating-vue": "^5.2.2", "lucide-vue-next": "^0.396.0", "pinia": "^2.1.7", + "splitpanes": "^3.1.5", "vee-validate": "^4.13.1", "vue": "^3.4.29", "vue-router": "^4.3.3", diff --git a/public/icons/arrow-back.svg b/public/icons/arrow-back.svg new file mode 100644 index 0000000..93ed762 --- /dev/null +++ b/public/icons/arrow-back.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/icons/arrows.svg b/public/icons/arrows.svg new file mode 100644 index 0000000..61e61bd --- /dev/null +++ b/public/icons/arrows.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/app/App.vue b/src/app/App.vue index 56ba833..c36478f 100644 --- a/src/app/App.vue +++ b/src/app/App.vue @@ -10,5 +10,5 @@ import { Toaster } from 'vue-sonner'; - + diff --git a/src/app/providers/router/index.ts b/src/app/providers/router/index.ts index ea9c0ff..de98924 100644 --- a/src/app/providers/router/index.ts +++ b/src/app/providers/router/index.ts @@ -81,7 +81,7 @@ export const router = createRouter({ router.beforeEach((to, from) => { // TODO(@mnenie): Add guards logic // Needs to add guard auth logic in router - if (to.meta.requiresAuth === true) { - return router.push({ name: RouteNames.login }); - } + // if (to.meta.requiresAuth === true) { + // return router.push({ name: RouteNames.login }); + // } }); diff --git a/src/app/styles/primary/exceptions.scss b/src/app/styles/primary/exceptions.scss index 1a90d27..89d1ee9 100644 --- a/src/app/styles/primary/exceptions.scss +++ b/src/app/styles/primary/exceptions.scss @@ -29,3 +29,15 @@ canvas{ width: 100% !important; height: 100% !important; } + +.splitpanes--vertical .splitpanes__pane{ + transition: none; +} + +.splitpanes--vertical > .splitpanes__splitter { + display: none; +} + +.splitpanes__pane{ + overflow: unset; +} diff --git a/src/features/filter/lib/composables/useFilter.ts b/src/features/filter/lib/composables/useFilter.ts new file mode 100644 index 0000000..c9de838 --- /dev/null +++ b/src/features/filter/lib/composables/useFilter.ts @@ -0,0 +1,40 @@ +import { nextTick, onMounted, onUnmounted } from 'vue'; +import type { Ref } from 'vue'; + +export default function useFilter( + inputRef: Ref, + props: { isExpanded: boolean }, + emit: (e: 'onToggle') => void +) { + const onToggleArea = () => { + if (!props.isExpanded) { + emit('onToggle'); + nextTick(() => { + inputRef.value = document.getElementById('input') as HTMLInputElement; + if (inputRef.value) { + inputRef.value.focus(); + } + }); + } + }; + const handleKeyDownFilter = (e: KeyboardEvent) => { + if (document) { + inputRef.value = document.getElementById('input')!; + if (e.metaKey && e.key === 'k') { + inputRef.value.focus(); + } + } + }; + + onMounted(() => { + window.addEventListener('keydown', handleKeyDownFilter); + }); + onUnmounted(() => { + window.removeEventListener('keydown', handleKeyDownFilter); + }); + + return { + handleKeyDownFilter, + onToggleArea + }; +} diff --git a/src/features/filter/ui/SearchFilter.vue b/src/features/filter/ui/SearchFilter.vue index 5f2cf28..568cdba 100644 --- a/src/features/filter/ui/SearchFilter.vue +++ b/src/features/filter/ui/SearchFilter.vue @@ -1,22 +1,42 @@