diff --git a/server/src/endpoints/management/create_bracket.ts b/server/src/endpoints/management/create_bracket.ts index 38ec542..22a17ba 100644 --- a/server/src/endpoints/management/create_bracket.ts +++ b/server/src/endpoints/management/create_bracket.ts @@ -8,6 +8,7 @@ import { deleteVoteButton } from "@/utils/components/buttons/delete_vote"; import { showUserVoteButton } from "@/utils/components/buttons/my_vote"; import { viewDBButton } from "@/utils/components/buttons/view_db"; import { countVotesButton } from "@/utils/components/buttons/count_votes"; +import { historyLinkButton } from "@/utils/components/buttons/history_site"; export default { method: `POST`, path: `/{guild_id}/bracket`, @@ -135,6 +136,10 @@ export default { components: [], }; + if (extra_buttons.includes(`historyLink`)) { + actionRow.components.push(historyLinkButton(gID)); + }; + if (extra_buttons.includes(`DB`)) { actionRow.components.push(viewDBButton); }; diff --git a/server/src/types/config.d.ts b/server/src/types/config.d.ts index 2a3b6cf..4e7856d 100644 --- a/server/src/types/config.d.ts +++ b/server/src/types/config.d.ts @@ -23,6 +23,7 @@ interface config { server: { host: string; port: number; + history_site_base: string; }; guilds: { [index: string]: channel_config; diff --git a/server/src/types/discord_components.ts b/server/src/types/discord_components.ts index 14ba9e3..c91e1e5 100644 --- a/server/src/types/discord_components.ts +++ b/server/src/types/discord_components.ts @@ -28,5 +28,6 @@ interface button { interface link_button { type: 2; style: 5; + label: string; url: string; } \ No newline at end of file diff --git a/server/src/utils/components/buttons/history_site.ts b/server/src/utils/components/buttons/history_site.ts new file mode 100644 index 0000000..6dc0a5b --- /dev/null +++ b/server/src/utils/components/buttons/history_site.ts @@ -0,0 +1,11 @@ +import { config } from "@/main"; + + +export const historyLinkButton = (guild_id: string): link_button => { + return { + type: 2, + style: 5, + label: `Bracket History`, + url: `${config.server.history_site_base}?gid=${guild_id}` + }; +}; \ No newline at end of file