replace bookmark with player, remove button in layout

This commit is contained in:
Scott Chacon 2023-03-16 17:44:58 +01:00
parent 9cf3021b5b
commit 22d5f013f4
2 changed files with 14 additions and 25 deletions

View File

@ -2,10 +2,10 @@
import { fade } from 'svelte/transition';
import FileIcon from './icons/FileIcon.svelte';
import CommitIcon from './icons/CommitIcon.svelte';
import BookmarkIcon from './icons/BookmarkIcon.svelte';
import BranchIcon from './icons/BranchIcon.svelte';
import ContactIcon from './icons/ContactIcon.svelte';
import ProjectIcon from './icons/ProjectIcon.svelte';
import IconPlayerPlayFilled from './icons/IconPlayerPlayFilled.svelte';
import { invoke } from '@tauri-apps/api';
import { goto } from '$app/navigation';
import { shortPath } from '$lib/paths';
@ -54,6 +54,7 @@
if (event.metaKey) {
switch (event.key) {
case 'k':
console.log('COMMAND');
showPalette = 'command';
setTimeout(function () {
document.getElementById('command')?.focus();
@ -66,6 +67,10 @@
case 'e':
executeCommand('contact');
break;
case 'p':
showPalette = false;
executeCommand('player');
break;
case 'r':
executeCommand('branch');
break;
@ -192,7 +197,12 @@
case 'switch':
goto('/projects/' + context);
break;
case 'bookmark':
case 'player':
if (context) {
goto(`/projects/${$currentProject?.id}/player?file=${encodeURIComponent(context)}`);
} else {
goto('/projects/' + $currentProject?.id + '/player');
}
break;
case 'branch':
showPalette = 'command';
@ -222,7 +232,7 @@
let projectCommands = [
{ text: 'Commit', key: 'C', icon: CommitIcon, command: 'commit' },
{ text: 'Bookmark', key: 'B', icon: BookmarkIcon, command: 'bookmark' },
{ text: 'Player', key: 'P', icon: IconPlayerPlayFilled, command: 'player' },
{ text: 'Branch', key: 'R', icon: BranchIcon, command: 'branch' }
];
@ -272,7 +282,7 @@
matchFiles({ projectId: $currentProject.id, matchPattern: searchPattern }).then((files) => {
let searchResults = [];
files.slice(0, 5).forEach((f) => {
searchResults.push({ text: f, icon: FileIcon });
searchResults.push({ text: f, icon: FileIcon, command: 'player', context: f });
});
updateMenu(searchResults);
});

View File

@ -89,27 +89,6 @@
>
⌘K
</div>
<a href="/projects/{$project?.id}/player" class="text-zinc-400 hover:text-zinc-200">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="currentColor"
class="h-6 w-6"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
<path
stroke-linecap="round"
stroke-linejoin="round"
d="M15.91 11.672a.375.375 0 010 .656l-5.603 3.113a.375.375 0 01-.557-.328V8.887c0-.286.307-.466.557-.327l5.603 3.112z"
/>
</svg>
</a>
</div>
<ul>