Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

845 B
Raw Blame
import { i18n } from '@mimik/core/env';
import { OnboardingRow, Switch } from '@mimik/ui';
import { useEffect, useState } from 'react';
import { LoginPicture } from './LoginPicture';

const MAC = navigator.userAgent.includes('Mac');

export function StartAtLoginRow() {
  const [atLogin, setAtLogin] = useState(false);

  useEffect(() => {
    void window.mimik.openAtLogin.get().then(setAtLogin);
  }, []);

  return (
    <OnboardingRow
      picture={<LoginPicture mac={MAC} />}
      title={i18n.t('desktop.startAtLogin')}
      hint={i18n.t(MAC ? 'desktop.startAtLoginHintMac' : 'desktop.startAtLoginHint')}
      control={
        <Switch
          checked={atLogin}
          label={i18n.t('desktop.startAtLogin')}
          onChange={async (next) => setAtLogin(await window.mimik.openAtLogin.set(next))}
        />
      }
    />
  );
}