Files
um-react/src/tabs/MainTab.tsx
2025-07-15 18:33:37 +00:00

48 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { RiErrorWarningLine } from 'react-icons/ri';
import { SelectFile } from '../components/SelectFile';
import { DownloadAll } from '~/components/DownloadAll.tsx';
import { FileListing } from '~/features/file-listing/FileListing';
import { useAppDispatch, useAppSelector } from '~/hooks.ts';
import { selectIsSettingsNotSaved } from '~/features/settings/settingsSelector.ts';
import { commitStagingChange } from '~/features/settings/settingsSlice.ts';
export function MainTab() {
const dispatch = useAppDispatch();
const isSettingsNotSaved = useAppSelector(selectIsSettingsNotSaved);
const onClickSaveSettings = () => {
dispatch(commitStagingChange());
};
return (
<div className="size-full max-w-[80%] self-center pt-4">
<div className="gap-3 flex flex-col">
{isSettingsNotSaved && (
<div role="alert" className="alert alert-warning gap-2">
<span className="md:flex flex-row items-center gap-1">
<RiErrorWarningLine className="size-6" />
<span className="font-bold hidden md:inline"></span>
</span>
<div>
<span className="block font-bold md:hidden"></span>
<span></span>
<span className="inline-block"></span>
</div>
<div>
<button type="button" className="btn btn-primary btn-sm" onClick={onClickSaveSettings}>
</button>
</div>
</div>
)}
<SelectFile />
<div className="w-full mt-4">
<FileListing />
</div>
<DownloadAll />
</div>
</div>
);
}