Add share tournament URL button

This commit is contained in:
Kalle
2026-03-24 21:46:16 +02:00
parent 31787b5807
commit cb286d37e5
17 changed files with 58 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import {
BookmarkCheck,
Check,
Clock,
Share2,
Trash,
User,
X,
@@ -16,6 +17,7 @@ import { Form, Link, useFetcher, useLoaderData } from "react-router";
import { useCopyToClipboard } from "react-use";
import { Alert } from "~/components/Alert";
import { Avatar } from "~/components/Avatar";
import { CopyToClipboardPopover } from "~/components/CopyToClipboardPopover";
import { Divider } from "~/components/Divider";
import { LinkButton, SendouButton } from "~/components/elements/Button";
import { SendouPopover } from "~/components/elements/Popover";
@@ -57,6 +59,7 @@ import {
SENDOU_INK_BASE_URL,
tournamentJoinPage,
tournamentOrganizationPage,
tournamentPage,
tournamentSubsPage,
userEditProfilePage,
userPage,
@@ -226,6 +229,7 @@ function TournamentRegisterInfoTabs() {
</div>
) : null}
<SaveTournamentButton />
<ShareTournamentButton />
</div>
<div className={styles.infoDescription}>
@@ -1327,6 +1331,44 @@ function SaveTournamentButton() {
);
}
function ShareTournamentButton() {
const { t } = useTranslation(["common"]);
const tournament = useTournament();
const url = `${SENDOU_INK_BASE_URL}${tournamentPage(tournament.ctx.id)}`;
const handleShare = () => {
navigator.share({ url });
};
if (
typeof navigator !== "undefined" &&
typeof navigator.share === "function"
) {
return (
<SendouButton
variant="outlined"
size="small"
icon={<Share2 />}
onPress={handleShare}
>
{t("common:actions.share")}
</SendouButton>
);
}
return (
<CopyToClipboardPopover
url={url}
trigger={
<SendouButton variant="outlined" size="small" icon={<Share2 />}>
{t("common:actions.share")}
</SendouButton>
}
/>
);
}
function TOPickedMapPoolInfo() {
const { t } = useTranslation(["calendar"]);
const tournament = useTournament();

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Hjælp og feedback",
"footer.patreon.subtitle": "Støt hjemmesiden",
"footer.thanks": "Tak til vores patrons for støtten",
"actions.share": "",
"actions.save": "Gem",
"actions.unsave": "",
"actions.saveChanges": "Gem ændringer",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Hilfe & Feedback",
"footer.patreon.subtitle": "Support",
"footer.thanks": "Danke an die Patrons für den Support",
"actions.share": "",
"actions.save": "Speichern",
"actions.unsave": "",
"actions.saveChanges": "Änderungen speichern",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Help & feedback",
"footer.patreon.subtitle": "Support",
"footer.thanks": "Thanks to the patrons for the support",
"actions.share": "Share",
"actions.save": "Save",
"actions.unsave": "Unsave",
"actions.saveChanges": "Save changes",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Ayuda y comentarios",
"footer.patreon.subtitle": "Apoyar",
"footer.thanks": "Gracias a los mecenas por su apoyo",
"actions.share": "",
"actions.save": "Guardar",
"actions.unsave": "",
"actions.saveChanges": "Guardar cambios",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Ayuda y comentarios",
"footer.patreon.subtitle": "Apoyar",
"footer.thanks": "Gracias a los Patrons por su apoyo",
"actions.share": "",
"actions.save": "Guardar",
"actions.unsave": "",
"actions.saveChanges": "Guardar cambios",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Aide & retours",
"footer.patreon.subtitle": "Soutien",
"footer.thanks": "Merci à nos Supporters pour le soutien",
"actions.share": "",
"actions.save": "Sauvegarder",
"actions.unsave": "",
"actions.saveChanges": "Sauvegarder les changements",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Aide & retours",
"footer.patreon.subtitle": "Soutien",
"footer.thanks": "Merci à nos Supporters pour le soutien",
"actions.share": "",
"actions.save": "Sauvegarder",
"actions.unsave": "",
"actions.saveChanges": "Sauvegarder les changements",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "עזרה ומשוב",
"footer.patreon.subtitle": "תמיכה",
"footer.thanks": "תודה לפטרונים על התמיכה",
"actions.share": "",
"actions.save": "שמירה",
"actions.unsave": "",
"actions.saveChanges": "שמירת שינויים",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Aiuto & feedback",
"footer.patreon.subtitle": "Supporto",
"footer.thanks": "Mille grazie ai supporter su Patreon!",
"actions.share": "",
"actions.save": "Salva",
"actions.unsave": "",
"actions.saveChanges": "Salva cambiamenti",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "ヘルプ & フィードバック",
"footer.patreon.subtitle": "寄付",
"footer.thanks": "寄付のご協力ありがとうございます",
"actions.share": "",
"actions.save": "保存",
"actions.unsave": "",
"actions.saveChanges": "変更を保存",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "도움 & 피드백",
"footer.patreon.subtitle": "후원",
"footer.thanks": "Patreon 후원자들에게 갑사드립니다",
"actions.share": "",
"actions.save": "저장하기",
"actions.unsave": "",
"actions.saveChanges": "수정사항 저장",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Help & Feedback",
"footer.patreon.subtitle": "Steun sendou.ink",
"footer.thanks": "Met dank aan alle patrons voor de steun",
"actions.share": "",
"actions.save": "Opslaan",
"actions.unsave": "",
"actions.saveChanges": "",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Pomoc",
"footer.patreon.subtitle": "Wsparcie",
"footer.thanks": "Dziękujemy patronom za wsparcie",
"actions.share": "",
"actions.save": "Zapisz",
"actions.unsave": "",
"actions.saveChanges": "Zapisz zmiany",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Ajuda e Feedback",
"footer.patreon.subtitle": "Suporte",
"footer.thanks": "Obrigado aos patronos e patronesses pelo suporte",
"actions.share": "",
"actions.save": "Salvar",
"actions.unsave": "",
"actions.saveChanges": "Salvar mudanças",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "Помощь и обратная связь",
"footer.patreon.subtitle": "Поддержать",
"footer.thanks": "Спасибо меценатам за поддержку",
"actions.share": "",
"actions.save": "Сохранить",
"actions.unsave": "",
"actions.saveChanges": "Сохранить изменения",

View File

@@ -104,6 +104,7 @@
"footer.discord.subtitle": "帮助及反馈",
"footer.patreon.subtitle": "支持",
"footer.thanks": "感谢Patreon上的支持者",
"actions.share": "",
"actions.save": "保存",
"actions.unsave": "",
"actions.saveChanges": "保存更改内容",