mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
add user notifications (#148)
* added notification settings * notifications: added list to profile * notifications: changed appearance for comment notifications
This commit is contained in:
parent
23701a5261
commit
a39d000ff2
27 changed files with 552 additions and 218 deletions
|
@ -88,10 +88,8 @@ export const getURL = (
|
|||
return file?.url ? getURLFromString(file.url, size) : '';
|
||||
};
|
||||
|
||||
export const formatText = pipe(
|
||||
formatTextSanitizeYoutube,
|
||||
export const formatTextWithoutImages = pipe(
|
||||
formatTextComments,
|
||||
formatTextTodos,
|
||||
formatExclamations,
|
||||
formatTextDash,
|
||||
formatTextMarkdown,
|
||||
|
@ -99,6 +97,12 @@ export const formatText = pipe(
|
|||
formatTextClickableUsernames,
|
||||
);
|
||||
|
||||
export const formatText = pipe(
|
||||
formatTextSanitizeYoutube,
|
||||
formatTextTodos,
|
||||
formatTextWithoutImages,
|
||||
);
|
||||
|
||||
export const formatTextParagraphs = (text: string): string =>
|
||||
(text && formatText(text)) || '';
|
||||
|
||||
|
|
31
src/utils/providers/NotificationProvider.tsx
Normal file
31
src/utils/providers/NotificationProvider.tsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import { createContext, FC, useContext } from 'react';
|
||||
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import { useNotificationSettings } from '~/hooks/notifications/useNotificationSettings';
|
||||
|
||||
interface NotificationProviderProps {}
|
||||
|
||||
const defaultValue = {
|
||||
available: false,
|
||||
enabled: false,
|
||||
hasNew: false,
|
||||
};
|
||||
|
||||
const NotificationContext = createContext(defaultValue);
|
||||
|
||||
const NotificationProvider: FC<NotificationProviderProps> = observer(
|
||||
({ children }) => {
|
||||
const value = useNotificationSettings();
|
||||
|
||||
return (
|
||||
<NotificationContext.Provider value={value}>
|
||||
{children}
|
||||
</NotificationContext.Provider>
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
export const useNotifications = () => useContext(NotificationContext);
|
||||
|
||||
export { NotificationProvider };
|
Loading…
Add table
Add a link
Reference in a new issue