summaryrefslogtreecommitdiff
path: root/src/components/InstallationButton.tsx
blob: 1bf10ac2978c1dcb51751dc75f1e8373270cc18c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { ButtonItem, PanelSectionRow } from "@decky/ui";
import t from '../i18n/i18n';

interface InstallationButtonProps {
  isInstalled: boolean;
  isInstalling: boolean;
  isUninstalling: boolean;
  onInstall: () => void;
  onUninstall: () => void;
}

export function InstallationButton({
  isInstalled,
  isInstalling,
  isUninstalling,
  onInstall,
  onUninstall
}: InstallationButtonProps) {
  const label = isInstalling
    ? t('INSTALL_INSTALLING', 'Installing...')
    : isUninstalling
      ? t('INSTALL_UNINSTALLING', 'Uninstalling...')
      : isInstalled
        ? t('INSTALL_UNINSTALL_BTN', 'Uninstall LSFG-VK')
        : t('INSTALL_INSTALL_BTN', 'Install LSFG-VK');

  return (
    <PanelSectionRow>
      <ButtonItem
        layout="below"
        onClick={isInstalled ? onUninstall : onInstall}
        disabled={isInstalling || isUninstalling}
      >
        {label}
      </ButtonItem>
    </PanelSectionRow>
  );
}