mirror of
https://github.com/trafficlunar/tomodachi-share.git
synced 2026-05-13 13:17:45 +00:00
fix: number inputs not updating values between tabs
This commit is contained in:
parent
7925c9e2f5
commit
825f74ef6d
4 changed files with 9 additions and 8 deletions
|
|
@ -7,7 +7,8 @@ import { ReportStatus } from "@prisma/client";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export default async function Reports() {
|
export default async function Reports() {
|
||||||
const reports = await prisma.report.findMany();
|
const reports = await prisma.report.findMany({ orderBy: { createdAt: "desc" } });
|
||||||
|
// TODO: add pagination
|
||||||
|
|
||||||
const updateStatus = async (formData: FormData) => {
|
const updateStatus = async (formData: FormData) => {
|
||||||
"use server";
|
"use server";
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ interface Props {
|
||||||
|
|
||||||
export default function NumberInputs({ target }: Props) {
|
export default function NumberInputs({ target }: Props) {
|
||||||
const [values, setValues] = useState<Record<string, number>>({
|
const [values, setValues] = useState<Record<string, number>>({
|
||||||
height: 0,
|
height: target?.height ?? 0,
|
||||||
distance: 0,
|
distance: target?.distance ?? 0,
|
||||||
rotation: 0,
|
rotation: target?.rotation ?? 0,
|
||||||
size: 0,
|
size: target?.size ?? 0,
|
||||||
stretch: 0,
|
stretch: target?.stretch ?? 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!target) return null;
|
if (!target) return null;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export default function EyesTab({ instructions }: Props) {
|
||||||
|
|
||||||
<div className="absolute inset-0 flex flex-col justify-center items-center">
|
<div className="absolute inset-0 flex flex-col justify-center items-center">
|
||||||
<ColorPicker disabled={currentTab.colorsDisabled} color={colors[tab]} setColor={setColor} tab={tab === 5 ? "eyeliner" : "eyes"} />
|
<ColorPicker disabled={currentTab.colorsDisabled} color={colors[tab]} setColor={setColor} tab={tab === 5 ? "eyeliner" : "eyes"} />
|
||||||
<NumberInputs target={instructions.current.eyes[currentTab.name]} />
|
<NumberInputs key={tab} target={instructions.current.eyes[currentTab.name]} />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ export default function OtherTab({ instructions }: Props) {
|
||||||
|
|
||||||
<div className="absolute inset-0 flex flex-col justify-center items-center">
|
<div className="absolute inset-0 flex flex-col justify-center items-center">
|
||||||
<ColorPicker disabled={tab === 0 || tab === 1} color={colors[tab]} setColor={setColor} tab={tab === 6 ? "eyeliner" : "hair"} />
|
<ColorPicker disabled={tab === 0 || tab === 1} color={colors[tab]} setColor={setColor} tab={tab === 6 ? "eyeliner" : "hair"} />
|
||||||
<NumberInputs target={instructions.current.other[currentTab.name]} />
|
<NumberInputs key={tab} target={instructions.current.other[currentTab.name]} />
|
||||||
|
|
||||||
{tab === 3 && (
|
{tab === 3 && (
|
||||||
<div className="flex gap-1.5 items-center mt-4">
|
<div className="flex gap-1.5 items-center mt-4">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue