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