diff --git a/src/assets/css/style.css b/src/assets/css/style.css index a2f9a05..deb3898 100755 --- a/src/assets/css/style.css +++ b/src/assets/css/style.css @@ -2206,6 +2206,12 @@ body { margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse))); } +.space-x-4 > :not([hidden]) ~ :not([hidden]) { + --tw-space-x-reverse: 0; + margin-right: calc(1rem * var(--tw-space-x-reverse)); + margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); +} + .space-y-1 > :not([hidden]) ~ :not([hidden]) { --tw-space-y-reverse: 0; margin-top: calc(0.25rem * calc(1 - var(--tw-space-y-reverse))); @@ -2224,12 +2230,6 @@ body { margin-bottom: calc(0.75rem * var(--tw-space-y-reverse)); } -.space-x-4 > :not([hidden]) ~ :not([hidden]) { - --tw-space-x-reverse: 0; - margin-right: calc(1rem * var(--tw-space-x-reverse)); - margin-left: calc(1rem * calc(1 - var(--tw-space-x-reverse))); -} - .divide-y > :not([hidden]) ~ :not([hidden]) { --tw-divide-y-reverse: 0; border-top-width: calc(1px * calc(1 - var(--tw-divide-y-reverse))); @@ -2475,6 +2475,10 @@ body { border-bottom-width: 0px; } +.border-b-2 { + border-bottom-width: 2px; +} + .border-l-4 { border-left-width: 4px; } @@ -2491,10 +2495,6 @@ body { border-top-width: 0px; } -.border-b-2 { - border-bottom-width: 2px; -} - .border-solid { border-style: solid; } @@ -2582,6 +2582,11 @@ body { border-color: rgb(255 51 51 / var(--tw-border-opacity)); } +.border-secondary-500 { + --tw-border-opacity: 1; + border-color: rgb(0 162 185 / var(--tw-border-opacity)); +} + .border-transparent { border-color: transparent; } @@ -2596,11 +2601,6 @@ body { border-color: rgb(255 255 51 / var(--tw-border-opacity)); } -.border-secondary-500 { - --tw-border-opacity: 1; - border-color: rgb(0 162 185 / var(--tw-border-opacity)); -} - .bg-black { --tw-bg-opacity: 1; background-color: rgb(0 0 0 / var(--tw-bg-opacity)); @@ -3715,6 +3715,16 @@ body { color: rgb(102 102 0 / var(--tw-text-opacity)); } +.text-slate-300 { + --tw-text-opacity: 1; + color: rgb(203 213 225 / var(--tw-text-opacity)); +} + +.text-slate-500 { + --tw-text-opacity: 1; + color: rgb(100 116 139 / var(--tw-text-opacity)); +} + .text-opacity-40 { --tw-text-opacity: 0.4; } @@ -3723,6 +3733,10 @@ body { text-decoration-line: underline; } +.no-underline { + text-decoration-line: none; +} + .placeholder-gray-500::-moz-placeholder { --tw-placeholder-opacity: 1; color: rgb(107 114 128 / var(--tw-placeholder-opacity)); @@ -5252,6 +5266,11 @@ body { color: rgb(51 51 0 / 0.9); } +:is(.dark .dark\:text-slate-500) { + --tw-text-opacity: 1; + color: rgb(100 116 139 / var(--tw-text-opacity)); +} + :is(.dark .dark\:text-opacity-70) { --tw-text-opacity: 0.7; } diff --git a/src/components/CommandPalettes.vue b/src/components/CommandPalettes.vue index bf3912b..9d5d1c1 100755 --- a/src/components/CommandPalettes.vue +++ b/src/components/CommandPalettes.vue @@ -1,36 +1,57 @@ - - - - - + + + + + - - - - - - - - - + + + + + + + + + - - - - Terakhir Diakses - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - {{ menu.name }} - - - {{ menu.path.replace('/home/', '') }} - - - - Buka - - - + + + {{ menu.name }} + + + {{ menu.path.replace('/home/', '') }} + + + + Buka + + + + + + + - - - - - + + Tidak ada hasil - - Tidak ada hasil - - - Kami tidak dapat menemukan menu apa pun dengan istilah itu saat ini, silahkan gunakan - kata kunci lainnya. - - - - - - - - + + Kami tidak dapat menemukan menu apa pun dengan istilah itu saat ini, silahkan + gunakan kata kunci lainnya. + + + + + + + + \ No newline at end of file +onMounted(() => { + window.addEventListener('keydown', (e) => command.onKeyPressed(e)) +}) + diff --git a/src/components/Navigation/Header.vue b/src/components/Navigation/Header.vue index 4101694..1ce7287 100755 --- a/src/components/Navigation/Header.vue +++ b/src/components/Navigation/Header.vue @@ -9,12 +9,15 @@ import PictureInitial from '@/components/PictureInitial.vue' import { useDialogStore } from '@/stores/dialog' import { IconApp, IconBars3 } from '@/utils/icons' import { RouterLink } from 'vue-router' +import { ref } from 'vue' +import { detectOS } from '@/utils/helper' const auth = useAuthStore() const user = useUserStore() const command = useCommandPalattesStore() const menu = useMenuStore() const dialog = useDialogStore() +const os = ref(detectOS()) const openSideBar = () => menu.toggleSidebar() @@ -35,7 +38,11 @@ const showDialogLogout = () => { - + Open sidebar @@ -44,36 +51,57 @@ const showDialogLogout = () => { - + Search - Cari menu + Cari menu + ⌘ M + class="flex items-center max-w-xs px-1 py-1 text-sm rounded-full bg-secondary-100 md:bg-primary-500 focus:outline-none focus:ring-0 line-clamp-1" + > Open user menu - + {{ user.user_name }} - + - + @@ -89,9 +117,12 @@ const showDialogLogout = () => { - - Log out - + + Log out + diff --git a/src/components/Pages/Welcome.vue b/src/components/Pages/Welcome.vue index cdea700..84c5317 100755 --- a/src/components/Pages/Welcome.vue +++ b/src/components/Pages/Welcome.vue @@ -1,100 +1,163 @@ - - - - - Search - - Cari menu - + + + + + Search + + + Cari menu + ⌘ M + - - - Silahkan cari menu atau buka menu di samping kiri untuk memulai - - + + + Silahkan cari menu atau buka menu di samping kiri untuk memulai + + - - - - Terakhir Diakses - - - - - - - - - - - - - + + + + Terakhir Diakses + + + + + + + + + + + + + - - - {{ menu.name }} - - - {{ menu.path.replace('/home/', '') }} - - - - Buka - - - - - - + + + {{ menu.name }} + + + {{ menu.path.replace('/home/', '') }} + + + Buka + + + - - - Copyright © 2023 PT PLN (Persero). All Rights Reserved - - + + + + Copyright © 2023 PT PLN (Persero). All Rights Reserved + + + \ No newline at end of file + diff --git a/src/stores/command.ts b/src/stores/command.ts index 487978e..dfb9bb9 100755 --- a/src/stores/command.ts +++ b/src/stores/command.ts @@ -6,103 +6,110 @@ import { extractLeafRoutes } from '@/router' import { useMenuStore } from '@/stores/menu' export const useCommandPalattesStore = defineStore('command_palettes', () => { - const open = ref(false) - const route = useRouter() - const menu = useMenuStore() - const controlStatus = ref(false) - const keyFStatus = ref(false) + const open = ref(false) + const route = useRouter() + const menu = useMenuStore() + const controlStatus = ref(false) + const keyFStatus = ref(false) - const showCommandPalettes = () => { - open.value = true + const showCommandPalettes = () => { + open.value = true + } + + const onKeyPressed = (event: KeyboardEvent) => { + if ((event.metaKey || event.ctrlKey) && event.key === 'm') { + showCommandPalettes() + // console.log('control pressed') + // controlStatus.value = true } - const onKeyPressed = (event: KeyboardEvent) => { - if (event.key === 'Control') { - console.log('control pressed'); - controlStatus.value = true - } + // if (event.key === 'f') { + // console.log('f pressed'); + // keyFStatus.value = true + // } - if (event.key === 'f') { - console.log('f pressed'); - keyFStatus.value = true - } + // if (controlStatus.value && keyFStatus.value) { + // showCommandPalettes() + // } + } - if (controlStatus.value && keyFStatus.value) { - showCommandPalettes() - } + const onKeyUp = (event: KeyboardEvent) => { + if (event.key === 'Control') { + console.log('control released') + controlStatus.value = false } - const onKeyUp = (event: KeyboardEvent) => { - if (event.key === 'Control') { - console.log('control released'); - controlStatus.value = false - } + if (event.key === 'f') { + console.log('f released') + keyFStatus.value = false + } + } - if (event.key === 'f') { - console.log('f released'); - keyFStatus.value = false - } + const readRecent = (): RouteRecordRaw[] => { + const recent = readDataJson('recentmenu') + if (recent) { + try { + JSON.parse(recent) + } catch (error) { + return recent as RouteRecordRaw[] + } + } + return [] as RouteRecordRaw[] + } + + const addRecent = (menu: RouteRecordRaw) => { + const lastRecent = readRecent() + const index = lastRecent.findIndex((item: RouteRecordRaw) => item.path === menu.path) + if (index > -1) { + lastRecent.splice(index, 1) + } + lastRecent.unshift(menu) + if (lastRecent.length > 5) { + lastRecent.pop() } - const readRecent = (): RouteRecordRaw[] => { - const recent = readDataJson('recentmenu') - if (recent) { - try { - JSON.parse(recent) - } catch (error) { - return recent as RouteRecordRaw[] - } - } - return [] as RouteRecordRaw[] - } + writeDataJson('recentmenu', lastRecent) + } - const addRecent = (menu: RouteRecordRaw) => { - const lastRecent = readRecent() - const index = lastRecent.findIndex((item: RouteRecordRaw) => item.path === menu.path) - if (index > -1) { - lastRecent.splice(index, 1) - } - lastRecent.unshift(menu) - if (lastRecent.length > 5) { - lastRecent.pop() - } + const searchRoutesByName = (routes: RouteRecordRaw[], query: string): RouteRecordRaw[] => { + const matchingRoutes = extractLeafRoutes(routes, '').filter( + (item: RouteRecordRaw) => + item.path.includes('home/') && + item.name?.toString().toLocaleLowerCase().includes(query.toLocaleLowerCase()) + ) + return matchingRoutes + } - writeDataJson('recentmenu', lastRecent) - } + const searchRoutesPath = (routes: RouteRecordRaw[], query: string): RouteRecordRaw[] => { + const matchingRoutes = extractLeafRoutes(routes, '').filter( + (item: RouteRecordRaw) => item.path.includes('home/') && item.path === query + ) + return matchingRoutes + } - const searchRoutesByName = (routes: RouteRecordRaw[], query: string): RouteRecordRaw[] => { - const matchingRoutes = extractLeafRoutes(routes, '').filter((item: RouteRecordRaw) => item.path.includes('home/') && item.name?.toString().toLocaleLowerCase().includes(query.toLocaleLowerCase())) - return matchingRoutes - } + const openMenu = (routeTarget: RouteRecordRaw) => { + addRecent(routeTarget) + route.push(routeTarget.path) + closeCommand() + setTimeout(() => { + menu.expandCurrentActiveMenu() + }, 200) + } - const searchRoutesPath = (routes: RouteRecordRaw[], query: string): RouteRecordRaw[] => { - const matchingRoutes = extractLeafRoutes(routes, '').filter((item: RouteRecordRaw) => item.path.includes('home/') && item.path === query) - return matchingRoutes - } + const closeCommand = () => { + open.value = false + } - const openMenu = (routeTarget: RouteRecordRaw) => { - addRecent(routeTarget) - route.push(routeTarget.path) - closeCommand() - setTimeout(() => { - menu.expandCurrentActiveMenu() - }, 200); - } - - const closeCommand = () => { - open.value = false - } - - return { - open, - showCommandPalettes, - onKeyPressed, - onKeyUp, - addRecent, - readRecent, - searchRoutesByName, - searchRoutesPath, - openMenu, - closeCommand - } -}) \ No newline at end of file + return { + open, + showCommandPalettes, + onKeyPressed, + onKeyUp, + addRecent, + readRecent, + searchRoutesByName, + searchRoutesPath, + openMenu, + closeCommand + } +}) diff --git a/src/utils/helper.ts b/src/utils/helper.ts index 0f38f66..f3bea4b 100644 --- a/src/utils/helper.ts +++ b/src/utils/helper.ts @@ -37,3 +37,17 @@ export const getDataRowGroup = (data: any): any => { } } } + +export const detectOS = () => { + const platform = navigator.userAgent.toLowerCase() + + if (platform.includes('mac')) { + return 'macOS' + } else if (platform.includes('win')) { + return 'Windows' + } else if (platform.includes('linux')) { + return 'Linux' + } else { + return 'Unknown' + } +}
- Kami tidak dapat menemukan menu apa pun dengan istilah itu saat ini, silahkan gunakan - kata kunci lainnya. -
+ Kami tidak dapat menemukan menu apa pun dengan istilah itu saat ini, silahkan + gunakan kata kunci lainnya. +
@@ -89,9 +117,12 @@ const showDialogLogout = () => {