frontend libs: strip unused imports + small type fixes

Cleanup pass to unblock pagedraw lib's source consumption — these were
existing TS errors (unused vars, missing override modifiers, a stale
.value access on a non-signal enum, Provider→GenerationProvider casts in
the deprecated provider-selector) that prevented dist regeneration.
No runtime behaviour changes other than the PromptBox3D
getCurrentAspectRatio fix, which previously always fell through to the
default branch because cameraAspectRatio is an enum, not a signal.
This commit is contained in:
Tanish Manku committed 2026-05-09 16:22:07 -07:00
1 parent 2d18a07843
commit 24e62ab7df
13 files changed
+13 -35

No files matched your search

@@ -6,7 +6,6 @@ import {
Model,
VIDEO_MODELS,
IMAGE_MODELS,
IMAGE_MODELS_BY_ID,
SPLAT_MODELS,
OBJECT_3D_MODELS,
} from "@storyteller/model-list";
@@ -48,15 +48,15 @@ export function ProviderSelector({
useEffect(() => {
if (!modelId) return;
if (!selectedProvider && allowedProviders.length > 0) {
setSelectedProvider(page, modelId, allowedProviders[0]);
setSelectedProvider(page, modelId, allowedProviders[0] as any);
}
}, [page, modelId, selectedProvider, allowedProviders, setSelectedProvider]);
const items: Omit<PopoverItem, "selected">[] = useMemo(
() =>
allowedProviders.map((p) => ({
label: getProviderDisplayName(p),
icon: getProviderIcon(p),
label: getProviderDisplayName(p as any),
icon: getProviderIcon(p as any),
model: undefined,
provider: p,
})),
@@ -78,7 +78,7 @@ export function ProviderSelector({
| Provider
| undefined;
if (!prov) return;
setSelectedProvider(page, modelId, prov);
setSelectedProvider(page, modelId, prov as any);
};
return (
@@ -173,7 +173,3 @@ export class Node {
}
}
}
function generateId(): string {
return `node-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
}
@@ -15,12 +15,10 @@ import {
Line,
Image,
Transformer,
Group,
} from "react-konva";
import Konva from "konva";
import { LineNode, SceneState, useSceneStore } from "./stores/SceneState";
import { Node } from "./Node";
import { useStageSnapshot } from "./hooks/useUpdateSnapshot";
import "./pagedraw.css";
import SplitPane from "./components/ui/SplitPane";
import { useRightPanelLayoutManagement } from "./hooks/useRightPanelLayoutManagement";
@@ -3,11 +3,7 @@ import { ImageStyleSelectorProps } from './types';
const ImageStyleSelector: React.FC<ImageStyleSelectorProps> = ({ onImageSelect }) => {
const fileInputRef = useRef<HTMLInputElement>(null);
const handleClick = () => {
fileInputRef.current?.click();
};
const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const files = e.target.files;
if (files && files.length > 0) {
@@ -2,7 +2,6 @@ import React, { useState, useRef, useEffect } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faMousePointer,
faTrash,
faEyeDropper,
faImage,
faUndo,
@@ -1,4 +1,3 @@
import { Vector2d } from "konva/lib/types";
import { useEffect } from "react";
import { DragState } from "../types";
// This piece of code ensures that when you are selecting or dragging and go off the stage,
@@ -96,7 +96,6 @@ export function CostBreakdownModal({ activeTabId }: CostBreakdownModalProps) {
const {
currency,
setCurrency,
currencyOption,
formatPrice,
currencyOptions,
} = useCurrency();
@@ -503,7 +503,7 @@ export const PromptBox3D = ({
};
const getCurrentAspectRatio = (): CommonAspectRatio => {
switch (cameraAspectRatio.value) {
switch (cameraAspectRatio) {
case CameraAspectRatio.HORIZONTAL_3_2:
return CommonAspectRatio.Wide;
case CameraAspectRatio.VERTICAL_2_3:
@@ -5,8 +5,6 @@ import {
} from "@fortawesome/pro-regular-svg-icons";
import {
faEdit,
faMessageCheck,
faMessageXmark,
faMousePointer,
faFrame,
faPen,
@@ -19,7 +17,7 @@ import {
faChevronUp,
} from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Button, ToggleButton, GenerateButton } from "@storyteller/ui-button";
import { Button, GenerateButton } from "@storyteller/ui-button";
import { ButtonIconSelect } from "@storyteller/ui-button-icon-select";
import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover";
import { Tooltip } from "@storyteller/ui-tooltip";
@@ -83,7 +81,6 @@ export const PromptBoxEdit = ({
credits,
}: PromptBoxEditProps) => {
const [prompt, setPrompt] = useState("");
const [useSystemPrompt, setUseSystemPrompt] = useState(true);
const [isFocused, setIsFocused] = useState(false);
const [isExpanded, setIsExpanded] = useState(false);
@@ -11,17 +11,17 @@ interface State {
}
export class PromptBoxErrorBoundary extends Component<Props, State> {
state: State = { hasError: false, resetKey: 0 };
override state: State = { hasError: false, resetKey: 0 };
static getDerivedStateFromError(): Partial<State> {
return { hasError: true };
}
componentDidCatch(error: Error, info: ErrorInfo) {
override componentDidCatch(error: Error, info: ErrorInfo) {
console.error("PromptBox crashed:", error, info.componentStack);
}
render() {
override render() {
if (this.state.hasError) {
return (
<div className="flex items-center justify-center rounded-xl border border-red-500/30 bg-red-500/10 px-6 py-4 text-sm text-red-300">
@@ -4,21 +4,19 @@ import { JobContextType, UploaderState } from "@storyteller/common";
import { toast } from "@storyteller/ui-toaster";
import { PopoverMenu, PopoverItem } from "@storyteller/ui-popover";
import { Tooltip } from "@storyteller/ui-tooltip";
import { Button, ToggleButton, GenerateButton } from "@storyteller/ui-button";
import { Button, GenerateButton } from "@storyteller/ui-button";
import { Modal } from "@storyteller/ui-modal";
import {
GenerateImage,
GenerateImageRequest,
} from "@storyteller/tauri-api";
import {
faMessageXmark,
faMessageCheck,
faExpand,
faChevronDown,
faChevronUp,
} from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { CommonAspectRatio, ImageModel } from "@storyteller/model-list";
import { ImageModel } from "@storyteller/model-list";
import { usePromptImageStore, RefImage, useEnterToGenerateStore } from "./promptStore";
import { gtagEvent } from "@storyteller/google-analytics";
import { twMerge } from "tailwind-merge";
@@ -29,7 +27,6 @@ import { AspectRatioIcon } from "./common/AspectRatioIcon";
import { GenerationCountPicker } from "./common/GenerationCountPicker";
import { ResolutionPicker } from "./common/ResolutionPicker";
import { QualityPicker } from "./common/QualityPicker";
import { CommonResolution } from "@storyteller/model-list";
interface PromptBoxImageProps {
useJobContext: () => JobContextType;
@@ -87,8 +84,6 @@ export const PromptBoxImage = ({
const prompt = usePromptImageStore((s) => s.prompt);
const setPrompt = usePromptImageStore((s) => s.setPrompt);
const useSystemPrompt = usePromptImageStore((s) => s.useSystemPrompt);
const setUseSystemPrompt = usePromptImageStore((s) => s.setUseSystemPrompt);
const aspectRatio = usePromptImageStore((s) => s.aspectRatio);
const setAspectRatio = usePromptImageStore((s) => s.setAspectRatio);
const resolution = usePromptImageStore((s) => s.resolution);
@@ -239,7 +239,7 @@ export const PromptBoxVideo = ({
aspectRatioOptions = buildAspectRatioOptions(DEFAULT_RESOLUTIONS);
}
const [aspectRatioList, setAspectRatioList] =
const [, setAspectRatioList] =
useState<PopoverItem[]>(aspectRatioOptions);
const textareaRef = useRef<HTMLTextAreaElement>(null);