Skip to content

Commit 8533500

Browse files
committed
feat: add not found screen
1 parent a2166c4 commit 8533500

File tree

8 files changed

+88
-1
lines changed

8 files changed

+88
-1
lines changed

front_end/messages/cs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,5 +1811,9 @@
18111811
"tournamentUnitPlural": "{unit, select, minute {minut} hour {hodin} day {dní} week {týdnů} month {měsíců} year {let} other {dní}}",
18121812
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> otázka} other {<num>#</num> otázek}}",
18131813
"tournamentQuestionsCountUpper": "<n>{count}</n> OTÁZKY",
1814+
"tournamentsEmptySearchTitle": "Nebyly nalezeny žádné výsledky",
1815+
"tournamentsEmptySearchBody": "Zkuste jiný vyhledávací výraz nebo vymažte vyhledávání.",
1816+
"tournamentsEmptyDefaultTitle": "Zobrazeno {count} turnajů",
1817+
"tournamentsEmptyDefaultBody": "Zkontrolujte později nebo vyzkoušejte jinou kartu.",
18141818
"othersCount": "Ostatní ({count})"
18151819
}

front_end/messages/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,5 +1805,9 @@
18051805
"tournamentUnitPlural": "{unit, select, minute {minutes} hour {hours} day {days} week {weeks} month {months} year {years} other {days}}",
18061806
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> question} other {<num>#</num> questions}}",
18071807
"tournamentQuestionsCountUpper": "<n>{count}</n> QUESTIONS",
1808+
"tournamentsEmptySearchTitle": "No results found",
1809+
"tournamentsEmptySearchBody": "Try a different search term, or clear the search.",
1810+
"tournamentsEmptyDefaultTitle": "{count} tournaments shown",
1811+
"tournamentsEmptyDefaultBody": "Check back later or try another tab.",
18081812
"none": "none"
18091813
}

front_end/messages/es.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1811,5 +1811,9 @@
18111811
"tournamentUnitPlural": "{unit, select, minute {minutos} hour {horas} day {días} week {semanas} month {meses} year {años} other {días}}",
18121812
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> pregunta} other {<num>#</num> preguntas}}",
18131813
"tournamentQuestionsCountUpper": "<n>{count}</n> PREGUNTAS",
1814+
"tournamentsEmptySearchTitle": "No se encontraron resultados",
1815+
"tournamentsEmptySearchBody": "Prueba un término de búsqueda diferente o borra la búsqueda.",
1816+
"tournamentsEmptyDefaultTitle": "{count} torneos mostrados",
1817+
"tournamentsEmptyDefaultBody": "Vuelve más tarde o prueba otra pestaña.",
18141818
"othersCount": "Otros ({count})"
18151819
}

front_end/messages/pt.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,5 +1809,9 @@
18091809
"tournamentUnitPlural": "{unit, select, minute {minutos} hour {horas} day {dias} week {semanas} month {meses} year {anos} other {dias}}",
18101810
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> pergunta} other {<num>#</num> perguntas}}",
18111811
"tournamentQuestionsCountUpper": "<n>{count}</n> PERGUNTAS",
1812+
"tournamentsEmptySearchTitle": "Nenhum resultado encontrado",
1813+
"tournamentsEmptySearchBody": "Tente um termo de pesquisa diferente ou limpe a pesquisa.",
1814+
"tournamentsEmptyDefaultTitle": "{count} torneios mostrados",
1815+
"tournamentsEmptyDefaultBody": "Volte mais tarde ou tente outra aba.",
18121816
"othersCount": "Outros ({count})"
18131817
}

front_end/messages/zh-TW.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,5 +1808,9 @@
18081808
"tournamentUnitPlural": "{unit, select, minute {分鐘} hour {小時} day {天} week {週} month {月} year {年} other {天}}",
18091809
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> 個問題} other {<num>#</num> 個問題}}",
18101810
"tournamentQuestionsCountUpper": "<n>{count}</n> 題問題",
1811+
"tournamentsEmptySearchTitle": "找不到結果",
1812+
"tournamentsEmptySearchBody": "嘗試使用不同的搜索詞,或清除搜索。",
1813+
"tournamentsEmptyDefaultTitle": "顯示 {count} 個比賽",
1814+
"tournamentsEmptyDefaultBody": "稍後再查看或嘗試其他標籤。",
18111815
"withdrawAfterPercentSetting2": "問題總生命周期後撤回"
18121816
}

front_end/messages/zh.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,5 +1813,9 @@
18131813
"tournamentUnitPlural": "{unit, select, minute {分钟} hour {小时} day {天} week {周} month {个月} year {年} other {天}}",
18141814
"tournamentQuestionsCount": "{count, plural, one {<num>#</num> 个问题} other {<num>#</num> 个问题}}",
18151815
"tournamentQuestionsCountUpper": "<n>{count}</n> 题目",
1816+
"tournamentsEmptySearchTitle": "未找到结果",
1817+
"tournamentsEmptySearchBody": "尝试不同的搜索词,或清除搜索。",
1818+
"tournamentsEmptyDefaultTitle": "显示了 {count} 场比赛",
1819+
"tournamentsEmptyDefaultBody": "稍后再查看或尝试其他选项卡。",
18161820
"othersCount": "其他({count})"
18171821
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
"use client";
2+
3+
import { useSearchParams } from "next/navigation";
4+
import { useTranslations } from "next-intl";
5+
import React from "react";
6+
7+
import cn from "@/utils/core/cn";
8+
9+
import { useTournamentsSection } from "./tournaments_provider";
10+
import { TOURNAMENTS_SEARCH } from "../constants/query_params";
11+
12+
type Props = {
13+
children: React.ReactNode;
14+
className?: string;
15+
};
16+
17+
const TournamentsResults: React.FC<Props> = ({ children, className }) => {
18+
const t = useTranslations();
19+
const { count } = useTournamentsSection();
20+
const params = useSearchParams();
21+
22+
const q = (params.get(TOURNAMENTS_SEARCH) ?? "").trim();
23+
const isSearching = q.length > 0;
24+
25+
type PlainKey = Parameters<typeof t>[0];
26+
27+
if (count > 0) {
28+
return <div className={className}>{children}</div>;
29+
}
30+
31+
const titleKey = (
32+
isSearching ? "tournamentsEmptySearchTitle" : "tournamentsEmptyDefaultTitle"
33+
) as PlainKey;
34+
35+
const bodyKey = (
36+
isSearching ? "tournamentsEmptySearchBody" : "tournamentsEmptyDefaultBody"
37+
) as PlainKey;
38+
39+
return (
40+
<div
41+
className={cn(
42+
"flex items-center justify-center",
43+
"min-h-[260px] lg:min-h-[360px]",
44+
className
45+
)}
46+
>
47+
<div className="text-center">
48+
<p className="my-0 text-[18px] font-medium text-blue-800/70 dark:text-blue-800-dark/70">
49+
{t(titleKey, { count })}
50+
</p>
51+
52+
<p className="mt-2 text-sm text-blue-700/60 dark:text-blue-700-dark/60">
53+
{t(bodyKey)}
54+
</p>
55+
</div>
56+
</div>
57+
);
58+
};
59+
60+
export default TournamentsResults;

front_end/src/app/(main)/(tournaments)/tournaments/components/tournaments_screen.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import TournamentsHero from "./tournaments_hero";
88
import TournamentsMobileCtrl from "./tournaments_mobile_ctrl";
99
import { TournamentsSectionProvider } from "./tournaments_provider";
1010
import { TournamentsSection } from "../types";
11+
import TournamentsResults from "./tournaments_results";
1112

1213
type Props = {
1314
current: TournamentsSection;
@@ -33,7 +34,9 @@ const TournamentsScreen: React.FC<Props> = ({
3334
<div className="mt-8">
3435
<TournamentsHero />
3536
<TournamentsMobileCtrl />
36-
<div className="mt-8 lg:mt-[50px]">{children}</div>
37+
<TournamentsResults className="mt-8 lg:mt-[50px]">
38+
{children}
39+
</TournamentsResults>
3740
</div>
3841
</TournamentsSectionProvider>
3942
</TournamentsContainer>

0 commit comments

Comments
 (0)