feat(frontend): remove preview notification, add note in profile, default dark mode.

This commit is contained in:
Aleksander Wilczyński 2024-12-08 19:13:55 +01:00
parent 0d949833d6
commit 1fc526bd43
Signed by untrusted user: alekswilc
GPG Key ID: D4464A248E5F27FE
6 changed files with 18 additions and 31 deletions

View File

@ -231,17 +231,23 @@ export const ProfileCard = ({ data }: { data: TProfileData }) =>
<div className="items-center justify-center p-2.5 flex xl:p-5 gap-2 flex-wrap sm:flex-nowrap"> <div className="items-center justify-center p-2.5 flex xl:p-5 gap-2 flex-wrap sm:flex-nowrap">
<button className="inline-flex items-center justify-center rounded-md bg-danger py-2 px-5 text-center font-medium text-white hover:bg-opacity-50 lg:px-4 xl:px-5" <button className="inline-flex items-center justify-center rounded-md bg-danger py-2 px-5 text-center font-medium text-white hover:bg-opacity-50 lg:px-4 xl:px-5"
onClick={ () => setClearStatsModal(true) }> onClick={ () => setClearStatsModal(true) }>
Clear stats {t("admin.clear.button")}
</button> </button>
<button className="inline-flex items-center justify-center rounded-md bg-danger py-2 px-5 text-center font-medium text-white hover:bg-opacity-50 lg:px-4 xl:px-5" <button className="inline-flex items-center justify-center rounded-md bg-danger py-2 px-5 text-center font-medium text-white hover:bg-opacity-50 lg:px-4 xl:px-5"
onClick={ () => setHideProfileModal(true) }> onClick={ () => setHideProfileModal(true) }>
Hide profile {t("admin.hide.button")}
</button> </button>
</div> </div>
</div> </div>
</> } </> }
<div className="shadow-default dark:bg-boxdark items-center justify-center p-2.5 flex flex-col xl:p-5 gap-2">
<h1 className="text-sm text-black dark:text-white">
{t("profile.info")}
</h1>
</div>
</div> </div>
</>; </>;
}; };

View File

@ -19,7 +19,7 @@ import useLocalStorage from "./useLocalStorage";
const useColorMode = () => const useColorMode = () =>
{ {
const [ colorMode, setColorMode ] = useLocalStorage<"light" | "dark">("color-theme", "light"); const [ colorMode, setColorMode ] = useLocalStorage<"light" | "dark">("color-theme", "dark");
useEffect(() => useEffect(() =>
{ {

View File

@ -99,7 +99,8 @@
"title": "Unable to display profile", "title": "Unable to display profile",
"description": "The player's profile could not be displayed due to active moderator actions." "description": "The player's profile could not be displayed due to active moderator actions."
} }
} },
"info": "Note: We have been collecting statistics since 13/12/2024."
}, },
"log": { "log": {
"errors": { "errors": {
@ -158,7 +159,7 @@
"title": "Are you sure?", "title": "Are you sure?",
"description": "This action will permanently clear user statistics." "description": "This action will permanently clear user statistics."
}, },
"button": "Clear profile",
"alert": "Player stats cleared." "alert": "Player stats cleared."
}, },
"hide": { "hide": {
@ -166,6 +167,7 @@
"title": "Are you sure?", "title": "Are you sure?",
"description": "This action will hide user profile from displaying in the leaderboard." "description": "This action will hide user profile from displaying in the leaderboard."
}, },
"button": "Hide profile",
"alert": "Player profile hidden." "alert": "Player profile hidden."
} }
} }

View File

@ -99,7 +99,8 @@
"title": "Nie można wyświetlić profilu", "title": "Nie można wyświetlić profilu",
"description": "Profil gracza nie mógł zostać wyświetlony ze względu na aktywne działania moderatora." "description": "Profil gracza nie mógł zostać wyświetlony ze względu na aktywne działania moderatora."
} }
} },
"info": "Uwaga: Gromadzimy statystyki od 13.12.2024 r."
}, },
"log": { "log": {
"errors": { "errors": {
@ -158,7 +159,7 @@
"title": "Czy jesteś pewien?", "title": "Czy jesteś pewien?",
"description": "Ta akcja permanentnie wyczyści wszystkie statystyki gracza." "description": "Ta akcja permanentnie wyczyści wszystkie statystyki gracza."
}, },
"button": "Wyczyść profil",
"alert": "Wyczyszczono statystyki gracza." "alert": "Wyczyszczono statystyki gracza."
}, },
"hide": { "hide": {
@ -166,6 +167,7 @@
"title": "Czy jesteś pewien?", "title": "Czy jesteś pewien?",
"description": "Ta akcja ukryje profil gracza." "description": "Ta akcja ukryje profil gracza."
}, },
"button": "Ukryj profil",
"alert": "Ukryto profil gracza." "alert": "Ukryto profil gracza."
} }
} }

View File

@ -14,35 +14,14 @@
* See LICENSE for more. * See LICENSE for more.
*/ */
import React, { useState, ReactNode, useEffect } from "react"; import React, { useState, ReactNode } from "react";
import { Header } from "../components/mini/header/Header"; import { Header } from "../components/mini/header/Header";
import { Sidebar } from "../components/mini/sidebar/Sidebar"; import { Sidebar } from "../components/mini/sidebar/Sidebar";
import { useCookies } from 'react-cookie';
import { toast } from "react-toastify";
import { useTranslation } from 'react-i18next';
export const DefaultLayout: React.FC<{ children: ReactNode }> = ({ children }) => export const DefaultLayout: React.FC<{ children: ReactNode }> = ({ children }) =>
{ {
const [ sidebarOpen, setSidebarOpen ] = useState(false); const [ sidebarOpen, setSidebarOpen ] = useState(false);
const { t } = useTranslation();
const [cookies, setCookie, _removeCookie] = useCookies(['info1'], { doNotParse: true, doNotUpdate: true });
useEffect(() =>
{
if (!cookies['info1']) {
setCookie('info1', true, {
maxAge: 259_200
});
toast.info(t("_.popup.ranking"), {
autoClose: 15_000,
});
}
}, []);
return ( return (
<div className="dark:bg-boxdark-2 dark:text-bodydark"> <div className="dark:bg-boxdark-2 dark:text-bodydark">
<div className="flex h-screen overflow-hidden"> <div className="flex h-screen overflow-hidden">

View File

@ -17,7 +17,6 @@
import { useTranslation, Trans } from "react-i18next"; import { useTranslation, Trans } from "react-i18next";
import { Link, useSearchParams } from "react-router-dom"; import { Link, useSearchParams } from "react-router-dom";
import { TStatsResponse } from "../types/stats.ts"; import { TStatsResponse } from "../types/stats.ts";
import { WarningAlert } from "../components/mini/alerts/Warning.tsx";
import { CardDataStats } from "../components/mini/util/CardDataStats.tsx"; import { CardDataStats } from "../components/mini/util/CardDataStats.tsx";
import { get } from "../util/fetcher.ts"; import { get } from "../util/fetcher.ts";
import useSWR from 'swr'; import useSWR from 'swr';
@ -40,7 +39,6 @@ export const Home = () =>
return ( return (
<> <>
<div className="flex pb-5"> <div className="flex pb-5">
<WarningAlert description={ t("preview.description") } title={ t("preview.title") }/>
{ error && <LoadError /> } { error && <LoadError /> }
</div> </div>