diff --git a/app/routes/a.tsx b/app/routes/a.tsx new file mode 100644 index 000000000..7b86324f4 --- /dev/null +++ b/app/routes/a.tsx @@ -0,0 +1,38 @@ +import { useLoaderData } from "@remix-run/react"; +import { Main } from "~/components/Main"; +import type { LinksFunction } from "@remix-run/node"; +import { json } from "@remix-run/node"; +import { mostRecentArticles } from "~/modules/articles"; +import styles from "~/styles/front.css"; +import { ArticlesPeek } from "."; +import { useTranslation } from "react-i18next"; +import type { SendouRouteHandle } from "~/utils/remix"; + +const MAX_ARTICLES_COUNT = 100; + +export const links: LinksFunction = () => { + return [{ rel: "stylesheet", href: styles }]; +}; + +export const handle: SendouRouteHandle = { + i18n: ["front"], +}; + +export const loader = async () => { + return json({ + recentArticles: await mostRecentArticles(MAX_ARTICLES_COUNT), + }); +}; + +export default function ArticlesMainPage() { + const { t } = useTranslation("common"); + const data = useLoaderData(); + const articles = data.recentArticles; + + return ( +
+

{t("pages.articles")}

+ +
+ ); +} diff --git a/app/routes/index.tsx b/app/routes/index.tsx index 88d7e94ff..113e74a60 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -16,6 +16,7 @@ import { discordFullName } from "~/utils/strings"; import { analyzerPage, articlePage, + ARTICLES_MAIN_PAGE, BADGES_PAGE, BUILDS_PAGE, calendarEventPage, @@ -50,6 +51,8 @@ export const loader = async () => { export default function Index() { const { t } = useTranslation(["common", "front"]); + const data = useLoaderData(); + const articles = data.recentArticles; return (
@@ -66,7 +69,12 @@ export default function Index() { {t("front:calendarGoTo")} - +
+ + + {t("front:articlesGoTo")} + +

{t("front:moreFeatures")}

@@ -124,17 +132,19 @@ function GoToPageBanner({ }: { children: React.ReactNode; to: string; - navItem: string; + navItem?: string; }) { return (
- {navItem} + {navItem && ( + {navItem} + )}
{children} @@ -251,13 +261,21 @@ function Event({ ); } -function ArticlesPeek() { +export function ArticlesPeek({ + articles, +}: { + articles: { + title: string; + author: string; + slug: string; + dateString: string; + }[]; +}) { const { t } = useTranslation("front"); - const data = useLoaderData(); return (
    - {data.recentArticles.map((article) => ( + {articles.map((article) => (
  • {article.title}
    diff --git a/app/utils/urls.ts b/app/utils/urls.ts index 7bce9e9cc..56ff9713d 100644 --- a/app/utils/urls.ts +++ b/app/utils/urls.ts @@ -36,6 +36,7 @@ export const ipLabsMaps = (pool: string) => export const LOG_IN_URL = "/auth"; export const LOG_OUT_URL = "/auth/logout"; export const ADMIN_PAGE = "/admin"; +export const ARTICLES_MAIN_PAGE = "/a"; export const FAQ_PAGE = "/faq"; export const CONTRIBUTIONS_PAGE = "/contributions"; export const BADGES_PAGE = "/badges"; @@ -85,7 +86,7 @@ export const mapsPage = (eventId?: MapPoolMap["calendarEventId"]) => `/maps${eventId ? `?eventId=${eventId}` : ""}`; export const readonlyMapsPage = (eventId: CalendarEvent["id"]) => `/maps?readonly&eventId=${eventId}`; -export const articlePage = (slug: string) => `/a/${slug}`; +export const articlePage = (slug: string) => `${ARTICLES_MAIN_PAGE}/${slug}`; export const analyzerPage = (args?: { weaponId: MainWeaponId; abilities: Ability[]; diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 175738ab5..9a1539d3e 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -1,5 +1,6 @@ { "pages.admin": "Admin", + "pages.articles": "Articles", "pages.badges": "Badges", "pages.plus": "Plus Server", "pages.contributors": "Contributors", diff --git a/public/locales/en/front.json b/public/locales/en/front.json index 4e43e6a55..f611f79b1 100644 --- a/public/locales/en/front.json +++ b/public/locales/en/front.json @@ -10,5 +10,6 @@ "object-damage-calculator.description": "Calculate damage dealt to different objects", "recentWinners": "Recent winners", "upcomingEvents": "Upcoming events", - "articleBy": "by {{author}}" + "articleBy": "by {{author}}", + "articlesGoTo": "View all articles from before" } diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index a6a6dccb3..d507373dd 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -1,5 +1,6 @@ { "pages.admin": "Admin", + "pages.articles": "Articles", "pages.badges": "Badges", "pages.plus": "Plus Server", "pages.contributors": "Contributeurs", diff --git a/public/locales/fr/front.json b/public/locales/fr/front.json index 3e4894bcd..c9b9a547a 100644 --- a/public/locales/fr/front.json +++ b/public/locales/fr/front.json @@ -6,5 +6,6 @@ "badges.description": "La liste de tous les badges que vous pouvez recevoir sur votre profil", "recentWinners": "Gagnants rΓ©cents", "upcomingEvents": "Γ‰vΓ©nements Γ  venir", - "articleBy": "par {{author}}" + "articleBy": "par {{author}}", + "articlesGoTo": "Voir tous les articles d'avant" } diff --git a/translation-progress.md b/translation-progress.md index 9f95e6e52..1651cb172 100644 --- a/translation-progress.md +++ b/translation-progress.md @@ -1,10 +1,118 @@ # Translation Progress -## /da (🟒 Done) +## /da (🟑 In progress) + +### 🟒 analyzer.json + +**112/112** + +### 🟒 badges.json + +**7/7** + +### 🟒 builds.json + +**11/11** + +### 🟒 calendar.json + +**46/46** + +### 🟑 common.json + +**75/76** + +
    +Missing + +- pages.articles + +
    + +### 🟒 contributions.json + +**6/6** + +### 🟒 faq.json + +**6/6** + +### 🟑 front.json + +**12/13** + +
    +Missing + +- articlesGoTo + +
    + +### 🟒 game-misc.json + +**22/22** + +### 🟒 user.json + +**25/25** --- -## /de (🟒 Done) +## /de (🟑 In progress) + +### 🟒 analyzer.json + +**112/112** + +### 🟒 badges.json + +**7/7** + +### 🟒 builds.json + +**11/11** + +### 🟒 calendar.json + +**46/46** + +### 🟑 common.json + +**75/76** + +
    +Missing + +- pages.articles + +
    + +### 🟒 contributions.json + +**6/6** + +### 🟒 faq.json + +**6/6** + +### 🟑 front.json + +**12/13** + +
    +Missing + +- articlesGoTo + +
    + +### 🟒 game-misc.json + +**22/22** + +### 🟒 user.json + +**25/25** --- @@ -62,11 +170,12 @@ ### 🟑 common.json -**48/75** +**48/76**
    Missing +- pages.articles - pages.s2 - pages.maps - pages.object-damage-calculator @@ -107,13 +216,14 @@ ### 🟑 front.json -**10/12** +**10/13**
    Missing - maps.description - object-damage-calculator.description +- articlesGoTo
    @@ -221,7 +331,7 @@ ### 🟑 common.json -**46/75** +**47/76**
    Missing @@ -276,7 +386,7 @@ ### 🟑 front.json -**8/12** +**9/13**
    Missing @@ -358,7 +468,7 @@ ### πŸ”΄ common.json -**0/75** +**0/76** ### πŸ”΄ contributions.json @@ -370,7 +480,7 @@ ### πŸ”΄ front.json -**0/12** +**0/13** ### 🟑 game-misc.json @@ -398,7 +508,61 @@ --- -## /ja (🟒 Done) +## /ja (🟑 In progress) + +### 🟒 analyzer.json + +**112/112** + +### 🟒 badges.json + +**7/7** + +### 🟒 builds.json + +**11/11** + +### 🟒 calendar.json + +**46/46** + +### 🟑 common.json + +**75/76** + +
    +Missing + +- pages.articles + +
    + +### 🟒 contributions.json + +**6/6** + +### 🟒 faq.json + +**6/6** + +### 🟑 front.json + +**12/13** + +
    +Missing + +- articlesGoTo + +
    + +### 🟒 game-misc.json + +**22/22** + +### 🟒 user.json + +**25/25** --- @@ -430,11 +594,12 @@ ### 🟑 common.json -**35/75** +**35/76**
    Missing +- pages.articles - pages.s2 - pages.analyzer - pages.maps @@ -495,7 +660,7 @@ ### 🟑 front.json -**8/12** +**8/13**
    Missing @@ -504,6 +669,7 @@ - analyzer.description - maps.description - object-damage-calculator.description +- articlesGoTo
    @@ -600,11 +766,12 @@ ### 🟑 common.json -**55/75** +**55/76**
    Missing +- pages.articles - pages.object-damage-calculator - auth.errors.aborted - auth.errors.failed @@ -638,12 +805,13 @@ ### 🟑 front.json -**11/12** +**11/13**
    Missing - object-damage-calculator.description +- articlesGoTo
    @@ -715,11 +883,12 @@ ### 🟑 common.json -**61/75** +**61/76**
    Missing +- pages.articles - actions.loading - actions.clear - actions.selectAll @@ -747,12 +916,13 @@ ### 🟑 front.json -**11/12** +**11/13**
    Missing - object-damage-calculator.description +- articlesGoTo
    @@ -828,11 +998,12 @@ ### 🟑 common.json -**35/75** +**35/76**
    Missing +- pages.articles - pages.s2 - pages.analyzer - pages.maps @@ -893,7 +1064,7 @@ ### 🟑 front.json -**8/12** +**8/13**
    Missing @@ -902,6 +1073,7 @@ - analyzer.description - maps.description - object-damage-calculator.description +- articlesGoTo