diff --git a/src/assets/locales/en.json b/src/assets/locales/en.json index c765342f..a9db3c83 100644 --- a/src/assets/locales/en.json +++ b/src/assets/locales/en.json @@ -7,18 +7,22 @@ "title": "Where does the content come from?" }, "q2": { + "body": "I do not collect donations for sudo-flix. All donations go directly to the movie-web team's kofi", + "title": "Where do my donations go?" + }, + "q3": { "body": "It's not possible to request a show or movie, sudo-flix does not manage any content. All content is viewed through sources on the internet.", "title": "Where can I request a show or movie?" }, - "q3": { + "q4": { "body": "Our search results are powered by The Movie Database (TMDB) and display regardless of whether our sources actually have the content.", "title": "The search results display the show or movie, why can't I play it?" }, - "q4": { + "q5": { "body": "All data is synced to the sudo-backend which is different than the community backend and is independently hosted by me, anyone is free to use this as well.", "title": "What about my data and stuff?" }, - "q5": { + "q6": { "body": "Well sudo-flix has a twitter account that can be found in the footer of this page as well as a link to the source code on Github.", "title": "How can I find out more?" }, diff --git a/src/pages/About.tsx b/src/pages/About.tsx index 6c1ef253..4ecd0fc0 100644 --- a/src/pages/About.tsx +++ b/src/pages/About.tsx @@ -67,11 +67,14 @@ export function AboutPage() { {t("about.q5.body")} , + + {t("about.q6.body")} + , ]} />
+
    void; children: React.ReactNode; @@ -66,7 +66,7 @@ function ConfigValue(props: { {link ? (

    navigate(link)} - className="cursor-pointer hover:underline" + className="transition duration-200 hover:underline cursor-pointer" > {props.name}

    @@ -204,7 +204,7 @@ export function TopFlix() { }); getTotalViews() .then((views) => { - setTotalViews(views); + setTotalViews(parseInt(views, 10).toLocaleString()); }) .catch((error) => { console.error("Error fetching total views:", error); @@ -241,24 +241,28 @@ export function TopFlix() { The most popular movies on sudo-flix.lol, this data is fetched from the current backend deployment. -
    -
    -

    - Server Lifetime: {timeSinceProcessStart} -

    +
    +
    +
    +

    + Server Lifetime: {timeSinceProcessStart} +

    +
    +
    +

    + Overall Views: {totalViews} +

    +
    -
    -

    - Overall Views: {totalViews} -

    +
    +
    - {/* */}
    @@ -276,7 +280,7 @@ export function TopFlix() { item.providerId.slice(1) }`}{" "} - {`Views: `} - {item.count} + {parseInt(item.count, 10).toLocaleString()} ); })} diff --git a/src/pages/TopSources.tsx b/src/pages/TopSources.tsx index b366372d..6da1ecb1 100644 --- a/src/pages/TopSources.tsx +++ b/src/pages/TopSources.tsx @@ -1,32 +1,28 @@ import { ReactNode, useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; // Import Link from react-router-dom +import { useNavigate } from "react-router-dom"; import { ThiccContainer } from "@/components/layout/ThinContainer"; import { Divider } from "@/components/utils/Divider"; import { Heading1, Paragraph } from "@/components/utils/Text"; import { SubPageLayout } from "./layouts/SubPageLayout"; -// import { MediaGrid } from "@/components/media/MediaGrid" -// import { TopFlixCard } from "@/components/media/FlixCard"; +import { Button } from "./TopFlix"; function ConfigValue(props: { name: string; children?: ReactNode }) { return ( <>

    -

    {props.name}

    +

    {props.name}

    {props.children}

    -

    - {/* props.type.charAt(0).toUpperCase() + props.type.slice(1) */} -

    ); } -async function getRecentPlayedItems() { +async function getTopSources() { const response = await fetch("https://backend.sudo-flix.lol/metrics"); const text = await response.text(); @@ -57,15 +53,34 @@ async function getRecentPlayedItems() { export function TopSources() { const [recentPlayedItems, setRecentPlayedItems] = useState([]); + const [failStatusCount, setFailStatusCount] = useState(0); + const [successStatusCount, setSuccessStatusCount] = useState(0); + const navigate = useNavigate(); useEffect(() => { - getRecentPlayedItems() + getTopSources() .then((items) => { const limitedItems = items.filter( (item, index, self) => index === self.findIndex((t2) => t2.providerId === item.providerId), ); setRecentPlayedItems(limitedItems); + + // Calculate fail and success status counts + const failCount = limitedItems.reduce( + (acc, item) => + item.status === "failed" || item.status === "notfound" + ? acc + parseInt(item.count, 10) + : acc, + 0, + ); + const successCount = limitedItems.reduce( + (acc, item) => + item.status === "success" ? acc + parseInt(item.count, 10) : acc, + 0, + ); + setFailStatusCount(failCount.toLocaleString()); + setSuccessStatusCount(successCount.toLocaleString()); }) .catch((error) => { console.error("Error fetching recent played items:", error); @@ -90,6 +105,28 @@ export function TopSources() { The most used providers on sudo-flix.lol, this data is fetched from the current backend deployment too. +
    +
    +
    +

    + Fail Count: {failStatusCount} +

    +
    +
    +

    + Success Count: {successStatusCount} +

    +
    +
    +
    + +
    +
    @@ -104,7 +141,7 @@ export function TopSources() { }`} > {`Requests: `} - {item.count} + {parseInt(item.count, 10).toLocaleString()} ); })}