Add sequential navigation

This commit is contained in:
gregor 2023-11-28 07:48:29 +03:00
parent aa955c5c85
commit ecd4fb9e6d
5 changed files with 34 additions and 76 deletions

19
package-lock.json generated
View File

@ -12,9 +12,9 @@
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^10.4.1",
"combokeys": "^3.0.1",
"dayjs": "^1.11.10",
"fuse.js": "^6.6.2",
"hotkeys-js": "^3.12.0",
"nanoid": "^5.0.1",
"pinia": "^2.1.6",
"register-service-worker": "^1.7.2",
@ -25,6 +25,7 @@
"vue3-spinners": "^1.2.2"
},
"devDependencies": {
"@types/combokeys": "^2.4.9",
"@vercel/node": "^3.0.7",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/cli-plugin-pwa": "~5.0.0",
@ -2637,6 +2638,12 @@
"@types/node": "*"
}
},
"node_modules/@types/combokeys": {
"version": "2.4.9",
"resolved": "https://registry.npmjs.org/@types/combokeys/-/combokeys-2.4.9.tgz",
"integrity": "sha512-Hwk0Z6XltfTKCxCPh0RVbg42PZQDsObrgFSh3MTmrcPPKj1iJByAdT1bmrfzmYr/66bjdC3c/T0b1c3cgS3Vjw==",
"dev": true
},
"node_modules/@types/connect": {
"version": "3.4.37",
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.37.tgz",
@ -4847,6 +4854,11 @@
"resolved": "https://registry.npmjs.org/colornames/-/colornames-1.1.1.tgz",
"integrity": "sha512-/pyV40IrsdulWv+wFPmERh9k/mjsPZ64yUMDmWrtj/k1nmgrzzIENWKdaVKyBbvFdQWqkcaRxr+polCo3VMe7A=="
},
"node_modules/combokeys": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/combokeys/-/combokeys-3.0.1.tgz",
"integrity": "sha512-5nAfaLZ3oO3kA+/xdoL7t197UJTz2WWidyH3BBeU6hqHtvyFERICd0y3DQFrQkJFTKBrtUDck/xCLLoFpnjaCw=="
},
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@ -7270,11 +7282,6 @@
"integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
"dev": true
},
"node_modules/hotkeys-js": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/hotkeys-js/-/hotkeys-js-3.12.0.tgz",
"integrity": "sha512-Z+N573ycUKIGwFYS3ID1RzMJiGmtWMGKMiaNLyJS8B1ei+MllF4ZYmKS2T0kMWBktOz+WZLVNikftEgnukOrXg=="
},
"node_modules/hpack.js": {
"version": "2.1.6",
"resolved": "https://registry.npmjs.org/hpack.js/-/hpack.js-2.1.6.tgz",

View File

@ -13,9 +13,9 @@
"@vuelidate/core": "^2.0.3",
"@vuelidate/validators": "^2.0.4",
"@vueuse/core": "^10.4.1",
"combokeys": "^3.0.1",
"dayjs": "^1.11.10",
"fuse.js": "^6.6.2",
"hotkeys-js": "^3.12.0",
"nanoid": "^5.0.1",
"pinia": "^2.1.6",
"register-service-worker": "^1.7.2",
@ -26,6 +26,7 @@
"vue3-spinners": "^1.2.2"
},
"devDependencies": {
"@types/combokeys": "^2.4.9",
"@vercel/node": "^3.0.7",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/cli-plugin-pwa": "~5.0.0",

View File

@ -1,41 +1,23 @@
<script setup lang="ts">
import Sidebar from "./components/Sidebar.vue";
import { onMounted } from "vue";
import hotkeys from "hotkeys-js";
import Combokeys from "combokeys";
import { computed, onMounted } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const combokeys = new Combokeys(document.documentElement);
onMounted(() => {
hotkeys.filter = (event) => {
if (event.metaKey) return true;
const target = event.target as HTMLElement;
const tagName = target?.tagName;
return !(
target.isContentEditable ||
tagName == "INPUT" ||
tagName == "SELECT" ||
tagName == "TEXTAREA"
);
};
// go to inbox page hotkey
hotkeys("cmd+i", (evt) => {
evt.preventDefault();
combokeys.bind("g i", () => {
router.push("/inbox");
});
// go to plan page hotkey
hotkeys("cmd+g", (evt) => {
evt.preventDefault();
router.push("/");
combokeys.bind("g p", () => {
router.push("/projects");
});
hotkeys("cmd+P", (evt) => {
evt.preventDefault();
router.push("/projects");
combokeys.bind("g r", () => {
router.push("/");
});
});
</script>

View File

@ -7,55 +7,19 @@ const navItems = ref([
title: "Plan",
icon: "plan",
link: "/",
hint: `
<svg width="13" height="14" viewBox="0 0 13 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_38_52)">
<path d="M5.41667 4.83333H7.58333V4.02083C7.58333 3.64587 7.69452 3.27933 7.90284 2.96757C8.11116 2.6558 8.40725 2.4128 8.75366 2.26931C9.10008 2.12582 9.48127 2.08828 9.84903 2.16143C10.2168 2.23458 10.5546 2.41514 10.8197 2.68028C11.0849 2.94541 11.2654 3.28322 11.3386 3.65098C11.4117 4.01873 11.3742 4.39992 11.2307 4.74634C11.0872 5.09276 10.8442 5.38885 10.5324 5.59716C10.2207 5.80548 9.85413 5.91667 9.47917 5.91667H8.66667V8.08333H9.47917C9.85413 8.08333 10.2207 8.19452 10.5324 8.40284C10.8442 8.61116 11.0872 8.90725 11.2307 9.25366C11.3742 9.60008 11.4117 9.98127 11.3386 10.349C11.2654 10.7168 11.0849 11.0546 10.8197 11.3197C10.5546 11.5849 10.2168 11.7654 9.84903 11.8386C9.48127 11.9117 9.10008 11.8742 8.75366 11.7307C8.40725 11.5872 8.11116 11.3442 7.90284 11.0324C7.69452 10.7207 7.58333 10.3541 7.58333 9.97917V9.16667H5.41667V9.97917C5.41667 10.3541 5.30548 10.7207 5.09716 11.0324C4.88885 11.3442 4.59276 11.5872 4.24634 11.7307C3.89992 11.8742 3.51873 11.9117 3.15098 11.8386C2.78322 11.7654 2.44541 11.5849 2.18028 11.3197C1.91514 11.0546 1.73458 10.7168 1.66143 10.349C1.58828 9.98127 1.62582 9.60008 1.76931 9.25366C1.9128 8.90725 2.1558 8.61116 2.46757 8.40284C2.77933 8.19452 3.14587 8.08333 3.52083 8.08333H4.33333V5.91667H3.52083C3.14587 5.91667 2.77933 5.80548 2.46757 5.59716C2.1558 5.38885 1.9128 5.09276 1.76931 4.74634C1.62582 4.39992 1.58828 4.01873 1.66143 3.65098C1.73458 3.28322 1.91514 2.94541 2.18028 2.68028C2.44541 2.41514 2.78322 2.23458 3.15098 2.16143C3.51873 2.08828 3.89992 2.12582 4.24634 2.26931C4.59276 2.4128 4.88885 2.6558 5.09716 2.96757C5.30548 3.27933 5.41667 3.64587 5.41667 4.02083V4.83333ZM4.33333 4.83333V4.02083C4.33333 3.86014 4.28568 3.70305 4.1964 3.56943C4.10712 3.43582 3.98023 3.33168 3.83176 3.27018C3.6833 3.20869 3.51993 3.1926 3.36232 3.22395C3.20471 3.2553 3.05994 3.33268 2.94631 3.44631C2.83268 3.55994 2.7553 3.70471 2.72395 3.86232C2.6926 4.01993 2.70869 4.1833 2.77018 4.33176C2.83168 4.48023 2.93582 4.60712 3.06943 4.6964C3.20305 4.78568 3.36014 4.83333 3.52083 4.83333H4.33333ZM4.33333 9.16667H3.52083C3.36014 9.16667 3.20305 9.21432 3.06943 9.3036C2.93582 9.39288 2.83168 9.51977 2.77018 9.66824C2.70869 9.8167 2.6926 9.98007 2.72395 10.1377C2.7553 10.2953 2.83268 10.4401 2.94631 10.5537C3.05994 10.6673 3.20471 10.7447 3.36232 10.7761C3.51993 10.8074 3.6833 10.7913 3.83176 10.7298C3.98023 10.6683 4.10712 10.5642 4.1964 10.4306C4.28568 10.297 4.33333 10.1399 4.33333 9.97917V9.16667ZM8.66667 4.83333H9.47917C9.63987 4.83333 9.79695 4.78568 9.93057 4.6964C10.0642 4.60712 10.1683 4.48023 10.2298 4.33176C10.2913 4.1833 10.3074 4.01993 10.2761 3.86232C10.2447 3.70471 10.1673 3.55994 10.0537 3.44631C9.94006 3.33268 9.79529 3.2553 9.63768 3.22395C9.48007 3.1926 9.3167 3.20869 9.16824 3.27018C9.01977 3.33168 8.89288 3.43582 8.8036 3.56943C8.71432 3.70305 8.66667 3.86014 8.66667 4.02083V4.83333ZM8.66667 9.16667V9.97917C8.66667 10.1399 8.71432 10.297 8.8036 10.4306C8.89288 10.5642 9.01977 10.6683 9.16824 10.7298C9.3167 10.7913 9.48007 10.8074 9.63768 10.7761C9.79529 10.7447 9.94006 10.6673 10.0537 10.5537C10.1673 10.4401 10.2447 10.2953 10.2761 10.1377C10.3074 9.98007 10.2913 9.8167 10.2298 9.66824C10.1683 9.51977 10.0642 9.39288 9.93057 9.3036C9.79695 9.21432 9.63987 9.16667 9.47917 9.16667H8.66667ZM5.41667 5.91667V8.08333H7.58333V5.91667H5.41667Z" fill="#CCCCCC"/>
</g>
<defs>
<clipPath id="clip0_38_52">
<rect width="13" height="13" fill="white" transform="translate(0 0.5)"/>
</clipPath>
</defs>
</svg>
<span>+ G</span>
`,
hint: `G then R`,
},
{
title: "Inbox",
icon: "inbox",
link: "/inbox",
hint: `
<svg width="13" height="14" viewBox="0 0 13 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_38_52)">
<path d="M5.41667 4.83333H7.58333V4.02083C7.58333 3.64587 7.69452 3.27933 7.90284 2.96757C8.11116 2.6558 8.40725 2.4128 8.75366 2.26931C9.10008 2.12582 9.48127 2.08828 9.84903 2.16143C10.2168 2.23458 10.5546 2.41514 10.8197 2.68028C11.0849 2.94541 11.2654 3.28322 11.3386 3.65098C11.4117 4.01873 11.3742 4.39992 11.2307 4.74634C11.0872 5.09276 10.8442 5.38885 10.5324 5.59716C10.2207 5.80548 9.85413 5.91667 9.47917 5.91667H8.66667V8.08333H9.47917C9.85413 8.08333 10.2207 8.19452 10.5324 8.40284C10.8442 8.61116 11.0872 8.90725 11.2307 9.25366C11.3742 9.60008 11.4117 9.98127 11.3386 10.349C11.2654 10.7168 11.0849 11.0546 10.8197 11.3197C10.5546 11.5849 10.2168 11.7654 9.84903 11.8386C9.48127 11.9117 9.10008 11.8742 8.75366 11.7307C8.40725 11.5872 8.11116 11.3442 7.90284 11.0324C7.69452 10.7207 7.58333 10.3541 7.58333 9.97917V9.16667H5.41667V9.97917C5.41667 10.3541 5.30548 10.7207 5.09716 11.0324C4.88885 11.3442 4.59276 11.5872 4.24634 11.7307C3.89992 11.8742 3.51873 11.9117 3.15098 11.8386C2.78322 11.7654 2.44541 11.5849 2.18028 11.3197C1.91514 11.0546 1.73458 10.7168 1.66143 10.349C1.58828 9.98127 1.62582 9.60008 1.76931 9.25366C1.9128 8.90725 2.1558 8.61116 2.46757 8.40284C2.77933 8.19452 3.14587 8.08333 3.52083 8.08333H4.33333V5.91667H3.52083C3.14587 5.91667 2.77933 5.80548 2.46757 5.59716C2.1558 5.38885 1.9128 5.09276 1.76931 4.74634C1.62582 4.39992 1.58828 4.01873 1.66143 3.65098C1.73458 3.28322 1.91514 2.94541 2.18028 2.68028C2.44541 2.41514 2.78322 2.23458 3.15098 2.16143C3.51873 2.08828 3.89992 2.12582 4.24634 2.26931C4.59276 2.4128 4.88885 2.6558 5.09716 2.96757C5.30548 3.27933 5.41667 3.64587 5.41667 4.02083V4.83333ZM4.33333 4.83333V4.02083C4.33333 3.86014 4.28568 3.70305 4.1964 3.56943C4.10712 3.43582 3.98023 3.33168 3.83176 3.27018C3.6833 3.20869 3.51993 3.1926 3.36232 3.22395C3.20471 3.2553 3.05994 3.33268 2.94631 3.44631C2.83268 3.55994 2.7553 3.70471 2.72395 3.86232C2.6926 4.01993 2.70869 4.1833 2.77018 4.33176C2.83168 4.48023 2.93582 4.60712 3.06943 4.6964C3.20305 4.78568 3.36014 4.83333 3.52083 4.83333H4.33333ZM4.33333 9.16667H3.52083C3.36014 9.16667 3.20305 9.21432 3.06943 9.3036C2.93582 9.39288 2.83168 9.51977 2.77018 9.66824C2.70869 9.8167 2.6926 9.98007 2.72395 10.1377C2.7553 10.2953 2.83268 10.4401 2.94631 10.5537C3.05994 10.6673 3.20471 10.7447 3.36232 10.7761C3.51993 10.8074 3.6833 10.7913 3.83176 10.7298C3.98023 10.6683 4.10712 10.5642 4.1964 10.4306C4.28568 10.297 4.33333 10.1399 4.33333 9.97917V9.16667ZM8.66667 4.83333H9.47917C9.63987 4.83333 9.79695 4.78568 9.93057 4.6964C10.0642 4.60712 10.1683 4.48023 10.2298 4.33176C10.2913 4.1833 10.3074 4.01993 10.2761 3.86232C10.2447 3.70471 10.1673 3.55994 10.0537 3.44631C9.94006 3.33268 9.79529 3.2553 9.63768 3.22395C9.48007 3.1926 9.3167 3.20869 9.16824 3.27018C9.01977 3.33168 8.89288 3.43582 8.8036 3.56943C8.71432 3.70305 8.66667 3.86014 8.66667 4.02083V4.83333ZM8.66667 9.16667V9.97917C8.66667 10.1399 8.71432 10.297 8.8036 10.4306C8.89288 10.5642 9.01977 10.6683 9.16824 10.7298C9.3167 10.7913 9.48007 10.8074 9.63768 10.7761C9.79529 10.7447 9.94006 10.6673 10.0537 10.5537C10.1673 10.4401 10.2447 10.2953 10.2761 10.1377C10.3074 9.98007 10.2913 9.8167 10.2298 9.66824C10.1683 9.51977 10.0642 9.39288 9.93057 9.3036C9.79695 9.21432 9.63987 9.16667 9.47917 9.16667H8.66667ZM5.41667 5.91667V8.08333H7.58333V5.91667H5.41667Z" fill="#CCCCCC"/>
</g>
<defs>
<clipPath id="clip0_38_52">
<rect width="13" height="13" fill="white" transform="translate(0 0.5)"/>
</clipPath>
</defs>
</svg>
<span>+ I</span>
`,
hint: `G then I`,
},
{
title: "Projects",
icon: "folder",
link: "/projects",
hint: `
<svg width="13" height="14" viewBox="0 0 13 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_38_52)">
<path d="M5.41667 4.83333H7.58333V4.02083C7.58333 3.64587 7.69452 3.27933 7.90284 2.96757C8.11116 2.6558 8.40725 2.4128 8.75366 2.26931C9.10008 2.12582 9.48127 2.08828 9.84903 2.16143C10.2168 2.23458 10.5546 2.41514 10.8197 2.68028C11.0849 2.94541 11.2654 3.28322 11.3386 3.65098C11.4117 4.01873 11.3742 4.39992 11.2307 4.74634C11.0872 5.09276 10.8442 5.38885 10.5324 5.59716C10.2207 5.80548 9.85413 5.91667 9.47917 5.91667H8.66667V8.08333H9.47917C9.85413 8.08333 10.2207 8.19452 10.5324 8.40284C10.8442 8.61116 11.0872 8.90725 11.2307 9.25366C11.3742 9.60008 11.4117 9.98127 11.3386 10.349C11.2654 10.7168 11.0849 11.0546 10.8197 11.3197C10.5546 11.5849 10.2168 11.7654 9.84903 11.8386C9.48127 11.9117 9.10008 11.8742 8.75366 11.7307C8.40725 11.5872 8.11116 11.3442 7.90284 11.0324C7.69452 10.7207 7.58333 10.3541 7.58333 9.97917V9.16667H5.41667V9.97917C5.41667 10.3541 5.30548 10.7207 5.09716 11.0324C4.88885 11.3442 4.59276 11.5872 4.24634 11.7307C3.89992 11.8742 3.51873 11.9117 3.15098 11.8386C2.78322 11.7654 2.44541 11.5849 2.18028 11.3197C1.91514 11.0546 1.73458 10.7168 1.66143 10.349C1.58828 9.98127 1.62582 9.60008 1.76931 9.25366C1.9128 8.90725 2.1558 8.61116 2.46757 8.40284C2.77933 8.19452 3.14587 8.08333 3.52083 8.08333H4.33333V5.91667H3.52083C3.14587 5.91667 2.77933 5.80548 2.46757 5.59716C2.1558 5.38885 1.9128 5.09276 1.76931 4.74634C1.62582 4.39992 1.58828 4.01873 1.66143 3.65098C1.73458 3.28322 1.91514 2.94541 2.18028 2.68028C2.44541 2.41514 2.78322 2.23458 3.15098 2.16143C3.51873 2.08828 3.89992 2.12582 4.24634 2.26931C4.59276 2.4128 4.88885 2.6558 5.09716 2.96757C5.30548 3.27933 5.41667 3.64587 5.41667 4.02083V4.83333ZM4.33333 4.83333V4.02083C4.33333 3.86014 4.28568 3.70305 4.1964 3.56943C4.10712 3.43582 3.98023 3.33168 3.83176 3.27018C3.6833 3.20869 3.51993 3.1926 3.36232 3.22395C3.20471 3.2553 3.05994 3.33268 2.94631 3.44631C2.83268 3.55994 2.7553 3.70471 2.72395 3.86232C2.6926 4.01993 2.70869 4.1833 2.77018 4.33176C2.83168 4.48023 2.93582 4.60712 3.06943 4.6964C3.20305 4.78568 3.36014 4.83333 3.52083 4.83333H4.33333ZM4.33333 9.16667H3.52083C3.36014 9.16667 3.20305 9.21432 3.06943 9.3036C2.93582 9.39288 2.83168 9.51977 2.77018 9.66824C2.70869 9.8167 2.6926 9.98007 2.72395 10.1377C2.7553 10.2953 2.83268 10.4401 2.94631 10.5537C3.05994 10.6673 3.20471 10.7447 3.36232 10.7761C3.51993 10.8074 3.6833 10.7913 3.83176 10.7298C3.98023 10.6683 4.10712 10.5642 4.1964 10.4306C4.28568 10.297 4.33333 10.1399 4.33333 9.97917V9.16667ZM8.66667 4.83333H9.47917C9.63987 4.83333 9.79695 4.78568 9.93057 4.6964C10.0642 4.60712 10.1683 4.48023 10.2298 4.33176C10.2913 4.1833 10.3074 4.01993 10.2761 3.86232C10.2447 3.70471 10.1673 3.55994 10.0537 3.44631C9.94006 3.33268 9.79529 3.2553 9.63768 3.22395C9.48007 3.1926 9.3167 3.20869 9.16824 3.27018C9.01977 3.33168 8.89288 3.43582 8.8036 3.56943C8.71432 3.70305 8.66667 3.86014 8.66667 4.02083V4.83333ZM8.66667 9.16667V9.97917C8.66667 10.1399 8.71432 10.297 8.8036 10.4306C8.89288 10.5642 9.01977 10.6683 9.16824 10.7298C9.3167 10.7913 9.48007 10.8074 9.63768 10.7761C9.79529 10.7447 9.94006 10.6673 10.0537 10.5537C10.1673 10.4401 10.2447 10.2953 10.2761 10.1377C10.3074 9.98007 10.2913 9.8167 10.2298 9.66824C10.1683 9.51977 10.0642 9.39288 9.93057 9.3036C9.79695 9.21432 9.63987 9.16667 9.47917 9.16667H8.66667ZM5.41667 5.91667V8.08333H7.58333V5.91667H5.41667Z" fill="#CCCCCC"/>
</g>
<defs>
<clipPath id="clip0_38_52">
<rect width="13" height="13" fill="white" transform="translate(0 0.5)"/>
</clipPath>
</defs>
</svg>
<span>+ P</span>
`,
hint: `G then P`,
},
{
title: "Integrations",

View File

@ -2,20 +2,24 @@
import { useProjectStore } from "@store/project.ts";
import ProjectRow from "@components/cards/ProjectRow.vue";
import { Project, ProjectStatistic } from "@models/project.model.ts";
import { computed, onUnmounted, ref } from "vue";
import { computed, onMounted, onUnmounted, ref } from "vue";
import { focusOnEditableElement } from "@utils/focus.ts";
import Icon from "../components/Icon.vue";
import hotkeys from "hotkeys-js";
import { useLocalStorage } from "@vueuse/core";
import Combokeys from "combokeys";
const projectStore = useProjectStore();
const rowsContainer = ref<HTMLElement | null>(null);
hotkeys("C", onCreateProject);
const combokeys = new Combokeys(document.documentElement);
onMounted(() => {
combokeys.bind("c", onCreateProject);
});
onUnmounted(() => {
hotkeys.unbind("C", "all", onCreateProject);
combokeys.unbind("c");
});
function onUpdateProject(id: string, project: Partial<Project>) {