Skip to content

Commit

Permalink
start image input
Browse files Browse the repository at this point in the history
  • Loading branch information
Tricks1228 committed Feb 10, 2025
1 parent dee2f02 commit 857c2e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/inputs/BaseInputProps.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from 'zod';

export const inputTypeSchema = z
.enum(['text', 'number', 'boolean', 'range', 'select', 'counter', 'timer'])
.enum(['text', 'number', 'boolean', 'range', 'select', 'counter', 'timer', 'image'])
.describe('The type of input');

export const inputBaseSchema = z.object({
Expand Down Expand Up @@ -71,6 +71,10 @@ export const timerInputSchema = inputBaseSchema.extend({
defaultValue: z.number().default(0).describe('The default value'),
});

export const imageInputSchema = inputBaseSchema.extend({
type: z.literal('image'),
});

export const sectionSchema = z.object({
name: z.string(),
fields: z.array(
Expand Down Expand Up @@ -206,6 +210,7 @@ export type CounterInputData = z.infer<typeof counterInputSchema>;
export type RangeInputData = z.infer<typeof rangeInputSchema>;
export type BooleanInputData = z.infer<typeof booleanInputSchema>;
export type TimerInputData = z.infer<typeof timerInputSchema>;
export type ImageInputData = z.infer<typeof imageInputSchema>;

export type InputPropsMap = {
text: StringInputData;
Expand All @@ -215,6 +220,7 @@ export type InputPropsMap = {
select: SelectInputData;
counter: CounterInputData;
timer: TimerInputData;
iamge: ImageInputData;
};

export type SectionProps = z.infer<typeof sectionSchema>;
Expand Down
10 changes: 10 additions & 0 deletions src/components/inputs/ImageInput.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { inputSelector, useQRScoutState } from "@/store/store";
import { ImageInputData } from './BaseInputProps';
import { ConfigurableInputProps } from "./ConfigurableInput";


export default function(props: ConfigurableInputProps) {
const data = useQRScoutState(

Check failure on line 7 in src/components/inputs/ImageInput.tsx

View workflow job for this annotation

GitHub Actions / deploy

'data' is declared but its value is never read.
inputSelector<ImageInputData>(props.section, props.code),
);
}

0 comments on commit 857c2e6

Please sign in to comment.