mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
Feature / Add working notifications with only twitter for now (#102)
* Add working notifications with only twitter for now * feat(notification-bar): I didnt copy from NP * Make default browser visibility true * feat(notifications): Collapse when no more notifications after closing one
This commit is contained in:
1 parent
11af8bfb5a
commit
40ec19a349
19 files changed
+497
-153
No files matched your search
@@ -5,6 +5,10 @@ import { useNuiEvent } from '../../../os/nui-events/hooks/useNuiEvent';
|
||||
import { IMAGE_DELIMITER } from '../utils/images';
|
||||
import { APP_TWITTER } from '../utils/constants';
|
||||
import { twitterState } from './state';
|
||||
import { useNotifications } from '../../../os/notifications/hooks/useNotifications';
|
||||
import { useApp } from '../../../os/apps/hooks/useApps';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
/**
|
||||
* Perform all necessary processing/transforms from the raw database
|
||||
@@ -28,6 +32,23 @@ function processTweet(tweet) {
|
||||
* there and have moved that logic here instead.
|
||||
*/
|
||||
export const useTwitterService = () => {
|
||||
const { t } = useTranslation();
|
||||
const { addNotification } = useNotifications();
|
||||
const { icon, notificationIcon } = useApp('TWITTER');
|
||||
|
||||
const setNotification = useCallback(
|
||||
({ profile_name, message }) =>
|
||||
addNotification({
|
||||
app: 'TWITTER',
|
||||
title: t('APPS_TWITTER_NEW_BROADCAST', { profile_name }),
|
||||
href: '/twitter',
|
||||
content: message,
|
||||
icon,
|
||||
notificationIcon,
|
||||
}),
|
||||
[addNotification, icon, notificationIcon, t]
|
||||
);
|
||||
|
||||
const setProfile = useSetRecoilState(twitterState.profile);
|
||||
const setUpdateProfileLoading = useSetRecoilState(
|
||||
twitterState.updateProfileLoading
|
||||
@@ -41,7 +62,6 @@ export const useTwitterService = () => {
|
||||
const setCreateSuccess = useSetRecoilState(
|
||||
twitterState.createTweetSuccessful
|
||||
);
|
||||
const setNotification = useSetRecoilState(twitterState.notification);
|
||||
|
||||
const _setUpdateProfileSuccess = (isSuccessful) => {
|
||||
setUpdateProfileSuccess(isSuccessful);
|
||||
|
||||
Reference in new issue
Block a user