generated from nhcarrigan/template
fix: lint and format issues in UserQuestionModal
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
import { get } from "svelte/store";
|
||||
import { SvelteSet } from "svelte/reactivity";
|
||||
import { claudeStore, hasQuestionPending } from "$lib/stores/claude";
|
||||
import { characterState } from "$lib/stores/character";
|
||||
import type { UserQuestionEvent } from "$lib/types/messages";
|
||||
|
||||
let isVisible = $state(false);
|
||||
let question: UserQuestionEvent | null = $state(null);
|
||||
let selectedOptions: Set<string> = $state(new Set());
|
||||
let selectedOptions: SvelteSet<string> = new SvelteSet();
|
||||
let customAnswer = $state("");
|
||||
let showCustomInput = $state(false);
|
||||
let grantedToolsList: string[] = $state([]);
|
||||
@@ -16,7 +17,7 @@
|
||||
hasQuestionPending.subscribe((pending) => {
|
||||
isVisible = pending;
|
||||
if (!pending) {
|
||||
selectedOptions = new Set();
|
||||
selectedOptions = new SvelteSet();
|
||||
customAnswer = "";
|
||||
showCustomInput = false;
|
||||
}
|
||||
@@ -41,22 +42,21 @@
|
||||
if (!question) return;
|
||||
|
||||
if (question.multi_select) {
|
||||
const newSet = new Set(selectedOptions);
|
||||
if (newSet.has(label)) {
|
||||
newSet.delete(label);
|
||||
if (selectedOptions.has(label)) {
|
||||
selectedOptions.delete(label);
|
||||
} else {
|
||||
newSet.add(label);
|
||||
selectedOptions.add(label);
|
||||
}
|
||||
selectedOptions = newSet;
|
||||
} else {
|
||||
selectedOptions = new Set([label]);
|
||||
selectedOptions.clear();
|
||||
selectedOptions.add(label);
|
||||
}
|
||||
showCustomInput = false;
|
||||
}
|
||||
|
||||
function selectCustom() {
|
||||
showCustomInput = true;
|
||||
selectedOptions = new Set();
|
||||
selectedOptions.clear();
|
||||
}
|
||||
|
||||
async function handleSubmitAndReconnect() {
|
||||
@@ -176,7 +176,7 @@ Please continue where we left off, taking my answer into account.`;
|
||||
</div>
|
||||
|
||||
<div class="mb-4 space-y-2">
|
||||
{#each question.options as option}
|
||||
{#each question.options as option (option.label)}
|
||||
<button
|
||||
onclick={() => toggleOption(option.label)}
|
||||
class="w-full text-left px-4 py-3 rounded-lg border transition-colors {selectedOptions.has(
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { writable, derived, get } from "svelte/store";
|
||||
import type { TerminalLine, ConnectionStatus, PermissionRequest, UserQuestionEvent } from "$lib/types/messages";
|
||||
import type {
|
||||
TerminalLine,
|
||||
ConnectionStatus,
|
||||
PermissionRequest,
|
||||
UserQuestionEvent,
|
||||
} from "$lib/types/messages";
|
||||
import type { CharacterState } from "$lib/types/states";
|
||||
import { cleanupConversationTracking } from "$lib/tauri";
|
||||
import { characterState } from "$lib/stores/character";
|
||||
@@ -100,10 +105,7 @@ function createConversationsStore() {
|
||||
activeConversation,
|
||||
($conv) => $conv?.pendingPermission || null
|
||||
);
|
||||
const pendingQuestion = derived(
|
||||
activeConversation,
|
||||
($conv) => $conv?.pendingQuestion || null
|
||||
);
|
||||
const pendingQuestion = derived(activeConversation, ($conv) => $conv?.pendingQuestion || null);
|
||||
|
||||
return {
|
||||
// Expose derived stores for compatibility
|
||||
|
||||
+5
-1
@@ -6,7 +6,11 @@ import { characterState } from "$lib/stores/character";
|
||||
import { configStore } from "$lib/stores/config";
|
||||
import { initStatsListener, resetSessionStats } from "$lib/stores/stats";
|
||||
import { initAchievementsListener } from "$lib/stores/achievements";
|
||||
import type { ConnectionStatus, PermissionPromptEvent, UserQuestionEvent } from "$lib/types/messages";
|
||||
import type {
|
||||
ConnectionStatus,
|
||||
PermissionPromptEvent,
|
||||
UserQuestionEvent,
|
||||
} from "$lib/types/messages";
|
||||
import type { CharacterState } from "$lib/types/states";
|
||||
import {
|
||||
initializeNotificationRules,
|
||||
|
||||
Reference in New Issue
Block a user