Skip to content

Commit

Permalink
feat(dl): add copy demo link button
Browse files Browse the repository at this point in the history
  • Loading branch information
akiver committed Dec 3, 2023
1 parent 264ec4c commit 417b20b
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ui/components/buttons/copy-demo-link-button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { Trans } from '@lingui/macro';
import { CopyButton } from './copy-button';

type Props = {
link: string;
};

export function CopyDemoLinkButton({ link }: Props) {
return (
<CopyButton data={link}>
<Trans context="Button">Copy demo link</Trans>
</CopyButton>
);
}
2 changes: 2 additions & 0 deletions src/ui/downloads/faceit/current-match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Match } from './match';
import { useCurrentMatch } from './use-current-match';
import { Button } from 'csdm/ui/components/buttons/button';
import { SeeDemoButton } from 'csdm/ui/downloads/see-demo-button';
import { CopyDemoLinkButton } from 'csdm/ui/components/buttons/copy-demo-link-button';

function SeeOnFaceitButton() {
const match = useCurrentMatch();
Expand Down Expand Up @@ -49,6 +50,7 @@ function ActionBar() {
<RevealDemoInExplorerButton demoFileName={match.id} downloadStatus={match.downloadStatus} />
<SeeDemoButton demoFileName={match.id} downloadStatus={match.downloadStatus} />
<WatchDemoButton demoFileName={match.id} game={match.game} downloadStatus={match.downloadStatus} />
{match.demoUrl && <CopyDemoLinkButton link={match.demoUrl} />}
<SeeOnFaceitButton />
</>
}
Expand Down
2 changes: 2 additions & 0 deletions src/ui/downloads/valve/current-match.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { SeeDemoButton } from '../see-demo-button';
import { useGetDownloadedDemoPath } from 'csdm/ui/downloads/use-get-downloaded-demo-path';
import { DownloadStatus } from 'csdm/common/types/download-status';
import { useSelectedPlayer } from './use-selected-player';
import { CopyDemoLinkButton } from 'csdm/ui/components/buttons/copy-demo-link-button';

export function CurrentMatch() {
const match = useSelectedMatch();
Expand All @@ -38,6 +39,7 @@ export function CurrentMatch() {
<RevealDemoInExplorerButton demoFileName={match.name} downloadStatus={match.downloadStatus} />
<SeeDemoButton demoFileName={match.name} downloadStatus={match.downloadStatus} />
<WatchDemoButton demoFileName={match.name} game={match.game} downloadStatus={match.downloadStatus} />
{match.demoUrl && <CopyDemoLinkButton link={match.demoUrl} />}
<CopyShareCodeButton shareCode={match.sharecode} />
</>
}
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,11 @@ msgctxt "Button"
msgid "Copy"
msgstr "Copy"

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr "Copy demo link"

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/es/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ msgctxt "Button"
msgid "Copy"
msgstr ""

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr ""

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/fr/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ msgctxt "Button"
msgid "Copy"
msgstr "Copier"

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr ""

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/pt-BR/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ msgctxt "Button"
msgid "Copy"
msgstr ""

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr ""

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/zh-CN/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ msgctxt "Button"
msgid "Copy"
msgstr ""

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr ""

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down
5 changes: 5 additions & 0 deletions src/ui/translations/zh-TW/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ msgctxt "Button"
msgid "Copy"
msgstr ""

#: src/ui/components/buttons/copy-demo-link-button.tsx
msgctxt "Button"
msgid "Copy demo link"
msgstr ""

#: src/ui/components/buttons/copy-share-code-button.tsx
msgctxt "Button"
msgid "Copy share code"
Expand Down

0 comments on commit 417b20b

Please sign in to comment.