Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lawvs committed Jul 28, 2024
1 parent 0a769fb commit 1af4230
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/filter/src/specs/preset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,21 @@ export const presetDataInputSpecs: DataInputViewSpec[] = [
(option: unknown) => option instanceof z.ZodLiteral,
);
},
view: ({ inputSchema, rule, onChange }) => {
view: function LiteralSelect({ inputSchema, rule, onChange }) {
const SelectView = useView("Select");
const unionSchema = inputSchema.items[0] as z.ZodUnion<any>;
console.log(unionSchema, unionSchema.options);
const options = unionSchema.options.map((item: z.ZodLiteral<string>) => ({
label: item.value,
value: item.value,
}));
const unionSchema = inputSchema.items[0] as z.ZodUnion<
[z.ZodLiteral<unknown>]
>;
const options = unionSchema.options.map(
(item: z.ZodLiteral<unknown>) => ({
label: item.description ?? String(item.value),
value: item.value,
}),
);
return (
<SelectView
options={options}
value={rule.arguments?.[0] as string}
value={rule.arguments?.[0]}
onChange={(value) => {
onChange({
...rule,
Expand Down

0 comments on commit 1af4230

Please sign in to comment.