mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 06:28:51 +00:00
tweak(phone/snackbar-provider): Altered API to expect a string for message, not a key (#135)
Change SnackbarProviderAlert message property to allow for any string rather than a explicit translation key
This commit is contained in:
10 files changed
+87
-19
No files matched your search
@@ -1,12 +1,21 @@
|
||||
import { useSetRecoilState } from 'recoil';
|
||||
import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { noteStates } from './state';
|
||||
import { useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { IAlert, useSnackbar } from '../../../ui/hooks/useSnackbar';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const useNotesService = () => {
|
||||
const { addAlert } = useSnackbar();
|
||||
const setNotes = useSetRecoilState(noteStates.noteItems);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleAddAlert = ({ message, type }: IAlert) => {
|
||||
addAlert({
|
||||
message: t(`APPS_${message}`),
|
||||
type,
|
||||
});
|
||||
};
|
||||
|
||||
useNuiEvent('NOTES', 'setNotes', setNotes);
|
||||
useNuiEvent('NOTES', 'setAlert', addAlert);
|
||||
useNuiEvent('NOTES', 'setAlert', handleAddAlert);
|
||||
};
|
||||
Reference in new issue
Block a user