mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-17 09:05:08 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { Transition } from '@headlessui/react';
|
|
import { type ReactNode } from 'react';
|
|
|
|
import { Button } from '@/components/ui/button';
|
|
import { useTranslation } from '@/hooks/use-translation';
|
|
|
|
interface SaveButtonProps {
|
|
processing: boolean;
|
|
recentlySuccessful: boolean;
|
|
/** Button label. Defaults to "Save"; pass a specific verb where the page has one. */
|
|
children?: ReactNode;
|
|
/** Submits a form rendered elsewhere in the tree, by id. */
|
|
form?: string;
|
|
}
|
|
|
|
/**
|
|
* The "Saved" acknowledgement that fades in once Inertia reports the request
|
|
* succeeded. Use it directly when the button row holds more than the submit
|
|
* button -- a delete dialog, a secondary action -- and SaveButton below when
|
|
* it does not.
|
|
*/
|
|
export function SavedIndicator({ recentlySuccessful }: { recentlySuccessful: boolean }) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<Transition show={recentlySuccessful} enter="transition ease-in-out" enterFrom="opacity-0" leave="transition ease-in-out" leaveTo="opacity-0">
|
|
<p className="text-sm text-neutral-600">{t('Saved')}</p>
|
|
</Transition>
|
|
);
|
|
}
|
|
|
|
/**
|
|
* A form's submit button and its "Saved" acknowledgement -- the pair most
|
|
* editable pages in the app end with.
|
|
*/
|
|
export function SaveButton({ processing, recentlySuccessful, children, form }: SaveButtonProps) {
|
|
const { t } = useTranslation();
|
|
|
|
return (
|
|
<div className="flex items-center gap-4">
|
|
<Button type="submit" form={form} disabled={processing}>
|
|
{children ?? t('Save')}
|
|
</Button>
|
|
|
|
<SavedIndicator recentlySuccessful={recentlySuccessful} />
|
|
</div>
|
|
);
|
|
}
|