This commit is contained in:
DrMint 2022-04-01 20:48:32 +02:00
parent e3c2e4da1d
commit 762df56aea
5 changed files with 27 additions and 21 deletions

View File

@ -11,9 +11,7 @@ type Props = {
href?: string; href?: string;
}; };
export default function LanguageSwitcher( export default function LanguageSwitcher(props: Props): JSX.Element {
props: Props
): JSX.Element {
const { locales, langui, href } = props; const { locales, langui, href } = props;
const router = useRouter(); const router = useRouter();

View File

@ -1,10 +1,10 @@
query getVideosSlugs { query getVideosSlugs {
videos(pagination: {limit:-1}) { videos(pagination: { limit: -1 }) {
data { data {
id id
attributes { attributes {
uid uid
} }
} }
} }
} }

View File

@ -86,7 +86,11 @@ export default function Video(props: Props): JSX.Element {
id="video" id="video"
className="w-full rounded-xl shadow-shade shadow-lg overflow-hidden" className="w-full rounded-xl shadow-shade shadow-lg overflow-hidden"
> >
<video className="w-full" src={getVideoFile(video.uid)} controls></video> <video
className="w-full"
src={getVideoFile(video.uid)}
controls
></video>
<div className="p-6 mt-2"> <div className="p-6 mt-2">
<h1 className="text-2xl">{video.title}</h1> <h1 className="text-2xl">{video.title}</h1>
<div className="flex flex-row flex-wrap gap-x-6 w-full"> <div className="flex flex-row flex-wrap gap-x-6 w-full">
@ -114,7 +118,10 @@ export default function Video(props: Props): JSX.Element {
: video.likes.toLocaleString()} : video.likes.toLocaleString()}
</p> </p>
)} )}
<Button href="" className="!py-0 !px-3">{`View on ${video.source}`}</Button> <Button
href=""
className="!py-0 !px-3"
>{`View on ${video.source}`}</Button>
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,5 +1,4 @@
import AppLayout from "components/AppLayout"; import AppLayout from "components/AppLayout";
import HorizontalLine from "components/HorizontalLine";
import PanelHeader from "components/PanelComponents/PanelHeader"; import PanelHeader from "components/PanelComponents/PanelHeader";
import ReturnButton, { import ReturnButton, {
ReturnButtonType, ReturnButtonType,

View File

@ -235,9 +235,11 @@ export function prettyShortenNumber(number: number): string {
maximumSignificantDigits: 3, maximumSignificantDigits: 3,
}); });
} else if (number > 1000) { } else if (number > 1000) {
return (number / 1000).toLocaleString(undefined, { return (
maximumSignificantDigits: 2, (number / 1000).toLocaleString(undefined, {
}) + "K"; maximumSignificantDigits: 2,
}) + "K"
);
} }
return number.toLocaleString(); return number.toLocaleString();
} }
@ -449,10 +451,10 @@ export function getLocalesFromLanguages(
: []; : [];
} }
export function getVideoThumbnailURL(uid: string):string { export function getVideoThumbnailURL(uid: string): string {
return `${process.env.NEXT_PUBLIC_URL_WATCH}/videos/${uid}.webp`; return `${process.env.NEXT_PUBLIC_URL_WATCH}/videos/${uid}.webp`;
} }
export function getVideoFile(uid: string):string { export function getVideoFile(uid: string): string {
return `${process.env.NEXT_PUBLIC_URL_WATCH}/videos/${uid}.mp4`; return `${process.env.NEXT_PUBLIC_URL_WATCH}/videos/${uid}.mp4`;
} }