From 74b191837e2b542dff8160000fac7aad54d25594 Mon Sep 17 00:00:00 2001 From: keyan Date: Thu, 21 Apr 2022 12:48:27 -0500 Subject: [PATCH] refine reply-only notifications --- api/resolvers/notifications.js | 4 ++-- api/typeDefs/notifications.js | 2 +- components/header.js | 2 +- components/header.module.css | 4 ++-- fragments/notifications.js | 4 ++-- .../{notifications/index.js => notifications.js} | 16 ++++++++-------- pages/notifications/[filter].js | 5 ----- styles/globals.scss | 8 ++++++++ svgs/chat-3-fill.svg | 1 + 9 files changed, 25 insertions(+), 21 deletions(-) rename pages/{notifications/index.js => notifications.js} (71%) delete mode 100644 pages/notifications/[filter].js create mode 100644 svgs/chat-3-fill.svg diff --git a/api/resolvers/notifications.js b/api/resolvers/notifications.js index 2663e45c..b7aaff5d 100644 --- a/api/resolvers/notifications.js +++ b/api/resolvers/notifications.js @@ -5,7 +5,7 @@ import { getInvoice } from './wallet' export default { Query: { - notifications: async (parent, { cursor, filter }, { me, models }) => { + notifications: async (parent, { cursor, inc }, { me, models }) => { const decodedCursor = decodeCursor(cursor) if (!me) { throw new AuthenticationError('you must be logged in') @@ -65,7 +65,7 @@ export default { // queries ... we only ever need at most LIMIT+current offset in the child queries to // have enough items to return in the union const notifications = await models.$queryRaw( - filter === 'replies' + inc === 'replies' ? `SELECT DISTINCT "Item".id::TEXT, "Item".created_at AS "sortTime", NULL::BIGINT as "earnedSats", 'Reply' AS type FROM "Item" diff --git a/api/typeDefs/notifications.js b/api/typeDefs/notifications.js index 8e1980db..8745db58 100644 --- a/api/typeDefs/notifications.js +++ b/api/typeDefs/notifications.js @@ -2,7 +2,7 @@ import { gql } from 'apollo-server-micro' export default gql` extend type Query { - notifications(cursor: String, filter: String): Notifications + notifications(cursor: String, inc: String): Notifications } type Votification { diff --git a/components/header.js b/components/header.js index b68d88fe..c92d25c8 100644 --- a/components/header.js +++ b/components/header.js @@ -36,7 +36,7 @@ export default function Header ({ sub }) { - + {me?.hasNewNotes && {' '} diff --git a/components/header.module.css b/components/header.module.css index b3a38dbf..174c8e2b 100644 --- a/components/header.module.css +++ b/components/header.module.css @@ -23,8 +23,8 @@ background-color: transparent !important; } -.navLink:first-child { - padding-left: 0 !important; +.navLink.active svg { + fill: var(--theme-navLinkActive); } .notification { diff --git a/fragments/notifications.js b/fragments/notifications.js index fe09eccf..3f16bd6a 100644 --- a/fragments/notifications.js +++ b/fragments/notifications.js @@ -6,8 +6,8 @@ export const NOTIFICATIONS = gql` ${ITEM_FIELDS} ${INVITE_FIELDS} - query Notifications($cursor: String, $filter: String) { - notifications(cursor: $cursor, filter: $filter) { + query Notifications($cursor: String, $inc: String) { + notifications(cursor: $cursor, inc: $inc) { cursor lastChecked notifications { diff --git a/pages/notifications/index.js b/pages/notifications.js similarity index 71% rename from pages/notifications/index.js rename to pages/notifications.js index 0c4d3227..b2336a47 100644 --- a/pages/notifications/index.js +++ b/pages/notifications.js @@ -1,9 +1,9 @@ import { Nav, Navbar } from 'react-bootstrap' -import { getGetServerSideProps } from '../../api/ssrApollo' -import Layout from '../../components/layout' -import Notifications from '../../components/notifications' -import { NOTIFICATIONS } from '../../fragments/notifications' -import styles from '../../components/header.module.css' +import { getGetServerSideProps } from '../api/ssrApollo' +import Layout from '../components/layout' +import Notifications from '../components/notifications' +import { NOTIFICATIONS } from '../fragments/notifications' +import styles from '../components/header.module.css' import Link from 'next/link' import { useRouter } from 'next/router' @@ -17,7 +17,7 @@ export default function NotificationPage ({ data: { notifications: { notificatio ) @@ -26,7 +26,7 @@ export default function NotificationPage ({ data: { notifications: { notificatio export function NotificationHeader () { const router = useRouter() return ( - +