2026-01-29 21:30:51 +00:00
|
|
|
import React from "react";
|
2026-03-08 18:44:59 +00:00
|
|
|
import { Params, useLoaderData, useParams, Link } from "react-router";
|
2026-03-04 21:14:18 +00:00
|
|
|
import { OrderSetProps, OrderSets } from "./OrderSets";
|
2026-03-14 21:17:41 +00:00
|
|
|
import { ProfileVerification } from "./ProfileVerification";
|
|
|
|
|
import { Title } from "@mantine/core";
|
2026-01-29 21:30:51 +00:00
|
|
|
|
|
|
|
|
export const subOrderSetsLoader = async ({
|
|
|
|
|
params: { username },
|
|
|
|
|
}: {
|
|
|
|
|
params: Params<string>;
|
2026-03-04 21:14:18 +00:00
|
|
|
}) => fetch(`/api/orders/${username}/sets`).then((response) => response.json());
|
2026-01-29 21:30:51 +00:00
|
|
|
|
|
|
|
|
export const SubOrderSets: React.FC = () => {
|
|
|
|
|
const { username: sub_username } = useParams();
|
2026-03-04 21:14:18 +00:00
|
|
|
const orderSets = useLoaderData<OrderSetProps["orderSets"]>();
|
2026-01-30 19:15:20 +00:00
|
|
|
|
2026-03-14 21:17:41 +00:00
|
|
|
const [profile, setProfile] = React.useState<UserProfile | null>(null);
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
fetch(`/api/subs/${sub_username}`)
|
|
|
|
|
.then((response) => response.json())
|
|
|
|
|
.then(setProfile);
|
|
|
|
|
}, [sub_username]);
|
|
|
|
|
|
2026-01-29 21:30:51 +00:00
|
|
|
return (
|
2026-03-14 21:17:41 +00:00
|
|
|
<>
|
|
|
|
|
<OrderSets
|
|
|
|
|
username={sub_username}
|
|
|
|
|
orderSets={orderSets}
|
|
|
|
|
linkBack={<Link to={`/dashboard/`}>Return to dashboard</Link>}
|
|
|
|
|
/>
|
|
|
|
|
{profile ? (
|
|
|
|
|
<>
|
|
|
|
|
<Title order={1} mb="md">
|
|
|
|
|
Sub Profile
|
|
|
|
|
</Title>
|
|
|
|
|
<ProfileVerification
|
|
|
|
|
username={sub_username}
|
|
|
|
|
verify_mastodon_favorite={profile.verify_mastodon_favorite}
|
|
|
|
|
verify_delay={profile.verify_delay}
|
|
|
|
|
/>
|
|
|
|
|
</>
|
|
|
|
|
) : null}
|
|
|
|
|
</>
|
2026-01-29 21:30:51 +00:00
|
|
|
);
|
|
|
|
|
};
|