sendou.ink/app/components/Main.tsx
Kalle 30063f6075
VoDs (#1283)
* YouTube lite embed + CSS bundled import

* Migration initial

* New VoD page initial functioning

* Table changes + add TODOs

* New structure for add vod page

* WIP add new VoD backend

* Merge branch 'rewrite' of https://github.com/Sendouc/sendou.ink into vods

* Fix when leaderboard appears

* Function new vod form

* Single vod page initial

* Different YouTubeEmbed

* Scroll to top when going to timestamp

* Vod match weapon/mode icons

* Vod page user

* Add date to vod page

* Adjust migration order

* Vod page many weapons

* Add title to vod page

* New vods page cast many weapons

* Add player index to order by

* Vods new more validation

* Vod listing page initial

* Vods page with filters

* Show message if no vods

* Fix not being to unset filters

* Fix seed sometimes throwing errors

* User page VoDs

* Vods nullable weapon combobox

* Link directly to user custom url from vod page

* Make video adder admin action

* Can add video checks

* i18n

* New VoD form tests

* VoD operates filters test

* Vods behind flag

* Remove from config
2023-02-26 14:31:57 +02:00

45 lines
1.0 KiB
TypeScript

import clsx from "clsx";
import type * as React from "react";
import { useMatches } from "react-router";
import { useUser } from "~/modules/auth";
import type { RootLoaderData } from "~/root";
export const Main = ({
children,
className,
classNameOverwrite,
halfWidth,
style,
}: {
children: React.ReactNode;
className?: string;
classNameOverwrite?: string;
halfWidth?: boolean;
style?: React.CSSProperties;
}) => {
const data = useMatches()[0]?.data as RootLoaderData | undefined;
const user = useUser();
const showLeaderboard = data?.gtagId && !user?.patronTier;
return (
<main
className={
classNameOverwrite
? clsx(classNameOverwrite, {
"half-width": halfWidth,
"pt-12-forced": showLeaderboard,
})
: clsx(
"layout__main",
"main",
{ "half-width": halfWidth, "pt-12-forced": showLeaderboard },
className
)
}
style={style}
>
{children}
</main>
);
};