feat: add svelte workspace feature panels

This commit is contained in:
2026-07-18 16:42:05 +08:00
parent a758996799
commit 7a2af1b938
6 changed files with 142 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
<script lang="ts">
export type Suggestion = {
kind: 'task' | 'note' | 'source';
title: string;
body: string;
};
export let suggestions: Suggestion[] = [];
export let onConfirm: (selected: Suggestion[]) => void;
let selectedIndexes: number[] = [];
function toggle(index: number) {
selectedIndexes = selectedIndexes.includes(index)
? selectedIndexes.filter((item) => item !== index)
: [...selectedIndexes, index];
}
function confirm() {
onConfirm(selectedIndexes.map((index) => suggestions[index]));
}
</script>
<section aria-label="AI 整理建议" class="suggestions">
{#each suggestions as suggestion, index}
<label class="suggestion">
<input
aria-label={`选择 ${suggestion.title}`}
type="checkbox"
checked={selectedIndexes.includes(index)}
on:change={() => toggle(index)}
/>
<span class="suggestion-body">
<strong>{suggestion.title}</strong>
<small>{suggestion.kind}</small>
<span>{suggestion.body}</span>
</span>
</label>
{/each}
<button type="button" on:click={confirm}>创建选中项</button>
</section>