UI Update (#179)

* feat: add publisher link to extension detail

* fix: improve IconMultiplexer and StoreExtDetail component rendering

* feat: add published date to extension details view

* chore: add moment.js and clean up imports in StoreExtDetail

* fix: support cloudflare worker

Otherwise cloudflare worker gets html instead of json

* refactor: move AppsCmds component to desktop app

* bump: version to 0.1.1

* fix: package.json fetching cors error

* fix: improve files field validation in verify command

* feat: make dropdown width in main search input dynamic

* feat(ui): add install button for web extension store

* update submodules

* format

* feat(desktop): disable clipboard auto paste for windows and linux

They are not implemented yet, current code only works for mac
This commit is contained in:
Huakun 2025-02-21 05:59:09 -05:00 committed by GitHub
parent 07c62e236c
commit 8a9f6bcb09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 41 additions and 36 deletions

2
Cargo.lock generated
View File

@ -7776,7 +7776,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-plugin-system-info" name = "tauri-plugin-system-info"
version = "2.0.8" version = "2.0.9"
dependencies = [ dependencies = [
"serde", "serde",
"starship-battery", "starship-battery",

View File

@ -139,7 +139,7 @@
<DropdownMenu.Trigger> <DropdownMenu.Trigger>
<Button variant="outline" size="icon"><EllipsisVerticalIcon /></Button> <Button variant="outline" size="icon"><EllipsisVerticalIcon /></Button>
</DropdownMenu.Trigger> </DropdownMenu.Trigger>
<DropdownMenu.Content class="w-80"> <DropdownMenu.Content class="w-fit min-w-80">
<DropdownMenu.Group> <DropdownMenu.Group>
<DropdownMenu.Item onclick={() => exit()}> <DropdownMenu.Item onclick={() => exit()}>
<CircleXIcon class="h-4 w-4 text-red-500" /> <CircleXIcon class="h-4 w-4 text-red-500" />

View File

@ -10,6 +10,7 @@
import { app } from "@tauri-apps/api" import { app } from "@tauri-apps/api"
import type { UnlistenFn } from "@tauri-apps/api/event" import type { UnlistenFn } from "@tauri-apps/api/event"
import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow" import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"
import { platform } from "@tauri-apps/plugin-os"
import { ArrowLeft, FileQuestionIcon, ImageIcon, LetterTextIcon } from "lucide-svelte" import { ArrowLeft, FileQuestionIcon, ImageIcon, LetterTextIcon } from "lucide-svelte"
import { onDestroy, onMount, type Snippet } from "svelte" import { onDestroy, onMount, type Snippet } from "svelte"
import { toast } from "svelte-sonner" import { toast } from "svelte-sonner"
@ -17,6 +18,7 @@
import * as userInput from "tauri-plugin-user-input-api" import * as userInput from "tauri-plugin-user-input-api"
import ContentPreview from "./content-preview.svelte" import ContentPreview from "./content-preview.svelte"
const _platform = platform()
const curWin = getCurrentWebviewWindow() const curWin = getCurrentWebviewWindow()
let searchTerm = $state("") let searchTerm = $state("")
let clipboardHistoryList = $state<ExtData[]>([]) let clipboardHistoryList = $state<ExtData[]>([])
@ -199,13 +201,16 @@
toast.warning("No data found") toast.warning("No data found")
return Promise.reject(new Error("No data found")) return Promise.reject(new Error("No data found"))
} }
return writeToClipboard(data).then(async () => return writeToClipboard(data).then(async () => {
app if (_platform === "macos") {
.hide() // TODO: add support for Windows and Linux
.then(() => sleep(100)) return app
.then(() => curWin.hide()) .hide()
.then(() => paste()) .then(() => sleep(100))
) .then(() => curWin.hide())
.then(() => paste())
}
})
}) })
.then(() => toast.success("Copied to clipboard")) .then(() => toast.success("Copied to clipboard"))
.catch((err) => { .catch((err) => {

View File

@ -281,7 +281,6 @@
) { ) {
// actionPanelOpen = true // actionPanelOpen = true
setTimeout(() => { setTimeout(() => {
console.log("toggle action panel")
actionPanelOpen = !actionPanelOpen actionPanelOpen = !actionPanelOpen
if (!actionPanelOpen) { if (!actionPanelOpen) {
onActionPanelBlur() onActionPanelBlur()
@ -298,8 +297,6 @@
function onkeydown(e: KeyboardEvent) { function onkeydown(e: KeyboardEvent) {
if (e.key === "Escape") { if (e.key === "Escape") {
console.log(document.activeElement)
console.log(document.activeElement?.nodeName)
if (document.activeElement?.nodeName === "INPUT") { if (document.activeElement?.nodeName === "INPUT") {
console.log("input") console.log("input")
} }
@ -376,7 +373,7 @@
{pbar} {pbar}
onGoBack={goBack} onGoBack={goBack}
onSubmit={(formData: Record<string, string | number | boolean>) => { onSubmit={(formData: Record<string, string | number | boolean>) => {
console.log("formData", formData) console.log("Submit formData", formData)
workerAPI?.onFormSubmit(formData) workerAPI?.onFormSubmit(formData)
}} }}
/> />

View File

@ -182,28 +182,31 @@
).format("YYYY-MM-DD HH:mm")}</pre> ).format("YYYY-MM-DD HH:mm")}</pre>
</div> </div>
</div> </div>
<div class="flex items-center space-x-2"> {#if !isInTauri}
{#if metadata && metadata.sourceType === ExtPublishSourceTypeEnum.jsr} <Button onclick={onInstallSelected}>Install</Button>
<a href={metadata.source} target="_blank"> {/if}
<Icon class="h-10 w-10" icon="vscode-icons:file-type-jsr" /> </div>
</a> <div class="mt-2 flex gap-2">
{:else if metadata && metadata.sourceType === ExtPublishSourceTypeEnum.npm} {#if metadata && metadata.sourceType === ExtPublishSourceTypeEnum.jsr}
<a href={metadata.source} target="_blank"> <a href={metadata.source} target="_blank">
<Icon class="h-10 w-10" icon="vscode-icons:file-type-npm" /> <Icon class="h-10 w-10" icon="vscode-icons:file-type-jsr" />
</a> </a>
{/if} {:else if metadata && metadata.sourceType === ExtPublishSourceTypeEnum.npm}
{#if metadata && metadata?.git?.commit && metadata?.rekorLogIndex && metadata?.git?.owner && metadata?.git?.repo} <a href={metadata.source} target="_blank">
<a <Icon class="h-10 w-10" icon="vscode-icons:file-type-npm" />
href={`https://github.com/${metadata.git.owner}/${metadata.git.repo}/tree/${metadata.git.commit}`} </a>
target="_blank" {/if}
> {#if metadata && metadata?.git?.commit && metadata?.rekorLogIndex && metadata?.git?.owner && metadata?.git?.repo}
<Badge class="h-8 space-x-2" variant="secondary"> <a
<Icon class="h-6 w-6" icon="mdi:github" /> href={`https://github.com/${metadata.git.owner}/${metadata.git.repo}/tree/${metadata.git.commit}`}
<span>{metadata.git.owner}/{metadata.git.repo}</span> target="_blank"
</Badge> >
</a> <Badge class="h-8 space-x-2" variant="secondary">
{/if} <Icon class="h-6 w-6" icon="mdi:github" />
</div> <span>{metadata.git.owner}/{metadata.git.repo}</span>
</Badge>
</a>
{/if}
</div> </div>
{#if metadata && metadata?.git?.commit && metadata?.rekorLogIndex && metadata?.git?.owner && metadata?.git?.repo} {#if metadata && metadata?.git?.commit && metadata?.rekorLogIndex && metadata?.git?.owner && metadata?.git?.repo}
<Separator class="my-3" /> <Separator class="my-3" />

@ -1 +1 @@
Subproject commit 282b6df90c6e4fc596e1be33e923e13270174ee1 Subproject commit 5d0424ddb61e217a03a4d3d75ef9a761d9901c41