feat(migration): moved changed log and properly added in the link to it
This commit is contained in:
@@ -1,33 +0,0 @@
|
||||
// src/components/Changelog.jsx
|
||||
import { marked } from "marked";
|
||||
import changelog from "../../../../CHANGELOG.md?raw"; // assuming changelog.md is in root
|
||||
|
||||
const Changelog = () => {
|
||||
const html: any = marked.parse(changelog);
|
||||
const recentChanges = html.split("<h2>")[1];
|
||||
// const [htmlContent, setHtmlContent] = useState("");
|
||||
|
||||
// useEffect(() => {
|
||||
// fetch("/changelog.md")
|
||||
// .then((res) => res.text())
|
||||
// .then((md) => {
|
||||
// const versionBlocks = md.split(/^##\s+/gm); // Split on headings
|
||||
// if (versionBlocks.length > 1) {
|
||||
// const latestBlock = `## ${versionBlocks[1]}`;
|
||||
// const html: any = marked.parse(latestBlock, {
|
||||
// breaks: true,
|
||||
// gfm: true,
|
||||
// });
|
||||
// setHtmlContent(html);
|
||||
// }
|
||||
// });
|
||||
// }, []);
|
||||
return (
|
||||
<div
|
||||
className="prose m-3"
|
||||
dangerouslySetInnerHTML={{ __html: `<h2>${recentChanges}` }}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Changelog;
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import Cards from "./Cards";
|
||||
//import { toast } from "sonner";
|
||||
|
||||
export function AddCards() {
|
||||
return (
|
||||
<Dialog>
|
||||
<DialogTrigger asChild>
|
||||
<Button variant="outline">Add Cards</Button>
|
||||
</DialogTrigger>
|
||||
<DialogContent className="min-w-fit ">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Cards</DialogTitle>
|
||||
<DialogDescription>
|
||||
Manage Cards and there settings.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex flex-row">
|
||||
<div className="">
|
||||
<Cards name={"ppoo"} inventory />
|
||||
<Cards name={"inv-empty"} rowType={"empty"} />
|
||||
<Cards name={"inv-fg"} rowType={"fg"} />
|
||||
</div>
|
||||
<div className="">
|
||||
<Cards name={"inv-materials"} rowType={"materials"} />
|
||||
<Cards name={"inv-packaging"} rowType={"packaging"} />
|
||||
<Cards name={"inv-waste"} rowType={"waste"} />
|
||||
<Cards name={"openOrder"} inventory />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <DialogFooter>
|
||||
<Button type="submit">Save changes</Button>
|
||||
</DialogFooter> */}
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
import { useCardStore } from "@/lib/store/useCardStore";
|
||||
import { Label } from "../ui/label";
|
||||
import { Checkbox } from "../ui/checkbox";
|
||||
import { Button } from "../ui/button";
|
||||
import { useAppForm } from "@/utils/formStuff";
|
||||
|
||||
export default function Cards(card: any) {
|
||||
const { addCard, removeCard, cards } = useCardStore();
|
||||
let existing: any = cards.filter((n: any) => n.name === card.name);
|
||||
|
||||
//console.log(existing);
|
||||
const form = useAppForm({
|
||||
defaultValues: {
|
||||
name: existing[0]?.name || card.name,
|
||||
rowType: existing[0]?.type ?? card.rowType,
|
||||
age: existing[0]?.age ?? 90,
|
||||
active: existing[0]?.active ?? false,
|
||||
},
|
||||
onSubmit: async ({ value }) => {
|
||||
console.log(value);
|
||||
const testCard: any = cards.filter(
|
||||
(i: any) => i.name === value.name
|
||||
);
|
||||
|
||||
if (value.active) {
|
||||
const newCard = {
|
||||
name: `${value.name}`,
|
||||
rowType: value.rowType,
|
||||
age: value.age ?? 90,
|
||||
active: value.active,
|
||||
};
|
||||
if (testCard.length > 0) {
|
||||
removeCard(value.name);
|
||||
addCard(newCard);
|
||||
return;
|
||||
}
|
||||
// change the name for a type card
|
||||
|
||||
addCard(newCard);
|
||||
} else {
|
||||
removeCard(value.name);
|
||||
}
|
||||
},
|
||||
});
|
||||
return (
|
||||
<div className="border-solid border-2 m-2">
|
||||
<p>{card.name}</p>
|
||||
<form
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}}
|
||||
className="flex flex-row"
|
||||
>
|
||||
<form.AppField
|
||||
name="active"
|
||||
// validators={{
|
||||
// // We can choose between form-wide and field-specific validators
|
||||
// onChange: ({ value }) =>
|
||||
// value.length > 3
|
||||
// ? undefined
|
||||
// : "Username must be longer than 3 letters",
|
||||
// }}
|
||||
children={(field) => {
|
||||
return (
|
||||
<div className="m-2 p-2 flex flex-row">
|
||||
<div>
|
||||
<Label htmlFor="active">
|
||||
<span>Active</span>
|
||||
</Label>
|
||||
</div>
|
||||
|
||||
<Checkbox
|
||||
className="ml-2"
|
||||
name={field.name}
|
||||
onBlur={field.handleBlur}
|
||||
checked={field.state.value}
|
||||
onCheckedChange={(e) =>
|
||||
field.handleChange(e)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
{!card.inventory && (
|
||||
<>
|
||||
<form.AppField
|
||||
name="age"
|
||||
children={(field) => (
|
||||
<field.InputField
|
||||
label="Age"
|
||||
inputType="number"
|
||||
required={true}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<div className="mt-7">
|
||||
<Button type="submit" onClick={() => form.handleSubmit()}>
|
||||
Save Card
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
import { useCardStore } from "@/lib/store/useCardStore";
|
||||
import INVCheckCard from "../logistics/warehouse/InventoryCard";
|
||||
import PPOO from "../logistics/warehouse/PPOOCard";
|
||||
import OpenOrders from "../logistics/warehouse/openOrders";
|
||||
|
||||
const componentsMap: any = {
|
||||
ppoo: PPOO,
|
||||
inv: INVCheckCard,
|
||||
openOrder: OpenOrders,
|
||||
//QualityRequest,
|
||||
};
|
||||
|
||||
export default function DashBoard() {
|
||||
const { cards } = useCardStore();
|
||||
|
||||
//console.log(cards);
|
||||
return (
|
||||
<div className="ml-5 w-11/12 h-9/10 grid grid-cols-12 gap-1">
|
||||
{cards.map((a: any) => {
|
||||
const name = a.name; //.filter((c) => c.i === card.i)[0].i || "name";
|
||||
|
||||
const Component = componentsMap[name.split("-")[0]];
|
||||
if (name === "openOrder") {
|
||||
return (
|
||||
<div key={a.name} className="col-span-6">
|
||||
<Component age={a.age} type={a.rowType} />
|
||||
</div>
|
||||
);
|
||||
} else {
|
||||
//console.log(name.split("-")[0], a);
|
||||
return (
|
||||
<div key={a.name} className="col-span-3">
|
||||
<Component data={a} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
// return (
|
||||
// <div className="ml-5 w-11/12 h-9/10 grid grid-cols-12 gap-1">
|
||||
// <div className="col-span-3">
|
||||
// <PPOO />
|
||||
// </div>
|
||||
// <div className="col-span-3">
|
||||
// <INVCheckCard age={90} type={"empty"} />
|
||||
// </div>
|
||||
// <div className="col-span-3">
|
||||
// <INVCheckCard age={75} type={"fg"} />
|
||||
// </div>
|
||||
// <div className="col-span-3">
|
||||
// <INVCheckCard age={30} type={"materials"} />
|
||||
// </div>
|
||||
// <div className="col-span-3">
|
||||
// <INVCheckCard age={7} type={"waste"} />
|
||||
// </div>
|
||||
// <div className="col-span-3">
|
||||
// <INVCheckCard age={7} type={"packaging"} />
|
||||
// </div>
|
||||
// </div>
|
||||
// );
|
||||
}
|
||||
|
||||
/*
|
||||
<div className="col-span-3">
|
||||
<PPOO />
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<INVCheckCard age={30} type={"empty"} />
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<INVCheckCard age={30} type={"fg"} />
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<INVCheckCard age={30} type={"materials"} />
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<INVCheckCard age={30} type={"waste"} />
|
||||
</div>
|
||||
<div className="col-span-3">
|
||||
<INVCheckCard age={30} type={"packaging"} />
|
||||
</div>
|
||||
*/
|
||||
Reference in New Issue
Block a user