lossless-cut/src/renderer/src/NoFileLoaded.tsx

54 wiersze
2.8 KiB
TypeScript
Czysty Zwykły widok Historia

2024-02-12 06:11:36 +00:00
import { memo } from 'react';
2020-12-11 16:04:15 +00:00
2021-03-29 15:11:08 +00:00
import { useTranslation, Trans } from 'react-i18next';
2020-12-11 16:04:15 +00:00
import SetCutpointButton from './components/SetCutpointButton';
2020-12-11 20:29:40 +00:00
import SimpleModeButton from './components/SimpleModeButton';
import useUserSettings from './hooks/useUserSettings';
2020-12-11 16:04:15 +00:00
const electron = window.require('electron');
2024-02-12 06:11:36 +00:00
const NoFileLoaded = memo(({ mifiLink, currentCutSeg, onClick, darkMode }: {
mifiLink: unknown, currentCutSeg, onClick: () => void, darkMode?: boolean,
}) => {
2020-12-11 16:04:15 +00:00
const { t } = useTranslation();
const { simpleMode } = useUserSettings();
2020-12-11 16:04:15 +00:00
return (
2023-04-04 12:22:42 +00:00
<div
className="no-user-select"
style={{ position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, border: '1.5vmin dashed var(--gray3)', color: 'var(--gray12)', margin: '5vmin', display: 'flex', flexDirection: 'column', justifyContent: 'center', alignItems: 'center', whiteSpace: 'nowrap' }}
role="button"
onClick={onClick}
>
<div style={{ fontSize: '6vmin', textTransform: 'uppercase', color: 'var(--gray11)' }}>{t('DROP FILE(S)')}</div>
2020-12-11 16:04:15 +00:00
<div style={{ fontSize: '2.5vmin', color: 'var(--gray11)', marginBottom: '.3em' }}>
<Trans>See <b>Help</b> menu for help</Trans>
2020-12-11 16:04:15 +00:00
</div>
<div style={{ fontSize: '2.5vmin', color: 'var(--gray11)' }}>
<Trans><SetCutpointButton currentCutSeg={currentCutSeg} side="start" style={{ verticalAlign: 'middle' }} /> <SetCutpointButton currentCutSeg={currentCutSeg} side="end" style={{ verticalAlign: 'middle' }} /> or <kbd>I</kbd> <kbd>O</kbd> to set cutpoints</Trans>
2020-12-11 16:04:15 +00:00
</div>
2023-04-04 12:22:42 +00:00
<div style={{ fontSize: '2.5vmin', color: 'var(--gray11)' }} role="button" onClick={(e) => e.stopPropagation()}>
2023-03-10 05:37:50 +00:00
{simpleMode ? (
<Trans><SimpleModeButton style={{ verticalAlign: 'middle' }} size={16} /> to show advanced view</Trans>
) : (
<Trans><SimpleModeButton style={{ verticalAlign: 'middle' }} size={16} /> to show simple view</Trans>
)}
2020-12-11 20:29:40 +00:00
</div>
2024-03-15 13:45:33 +00:00
{mifiLink && typeof mifiLink === 'object' && 'loadUrl' in mifiLink && typeof mifiLink.loadUrl === 'string' && mifiLink.loadUrl ? (
2020-12-11 16:04:15 +00:00
<div style={{ position: 'relative', margin: '3vmin', width: '60vmin', height: '20vmin' }}>
2023-04-04 13:35:36 +00:00
<iframe src={`${mifiLink.loadUrl}#dark=${darkMode ? 'true' : 'false'}`} title="iframe" style={{ background: 'rgba(0,0,0,0)', border: 'none', pointerEvents: 'none', width: '100%', height: '100%', position: 'absolute' }} />
2020-12-11 16:04:15 +00:00
{/* eslint-disable-next-line jsx-a11y/interactive-supports-focus */}
2024-02-12 06:11:36 +00:00
<div style={{ width: '100%', height: '100%', position: 'absolute', cursor: 'pointer' }} role="button" onClick={(e) => { e.stopPropagation(); if ('targetUrl' in mifiLink && typeof mifiLink.targetUrl === 'string') electron.shell.openExternal(mifiLink.targetUrl); }} />
2020-12-11 16:04:15 +00:00
</div>
2024-03-15 13:45:33 +00:00
) : undefined}
2020-12-11 16:04:15 +00:00
</div>
);
});
export default NoFileLoaded;