From 10e2e891e946a02bfdc67a7d76f43a2924228e05 Mon Sep 17 00:00:00 2001 From: hellno Date: Wed, 21 Aug 2024 14:12:09 +0200 Subject: [PATCH] improve command palette --- package.json | 2 +- pages/notifications/index.tsx | 5 ++-- .../components/CommandPalette/index.tsx | 2 +- src/common/components/Sidebar/ProfileInfo.tsx | 23 +++++++++++-------- src/home/index.tsx | 3 ++- src/stores/useAccountStore.ts | 6 ++++- yarn.lock | 6 ++--- 7 files changed, 28 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index 5ba823a5..de8e67c9 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "@hatsprotocol/modules-sdk": "^0.15.2", "@hatsprotocol/sdk-v1-core": "^0.9.0", "@headlessui/react": "^2.1.0", - "@heroicons/react": "^2.0.18", + "@heroicons/react": "^2.1.5", "@hookform/resolvers": "^3.4.2", "@mod-protocol/mod-registry": "^0.1.0", "@mod-protocol/react": "^0.2.0", diff --git a/pages/notifications/index.tsx b/pages/notifications/index.tsx index a7381d5d..5dcb9512 100644 --- a/pages/notifications/index.tsx +++ b/pages/notifications/index.tsx @@ -251,11 +251,12 @@ const Notifications = () => { ); const getActionDescriptionForRow = (notification: Notification): string => { + const cast = notification.cast; switch (notification.type) { case NotificationTypeEnum.Reply: - return `@${notification.cast.author.username} replied`; + return cast ? `@${cast.author.username} replied` : "Someone replied"; case NotificationTypeEnum.Mention: - return `@${notification.cast.author.username} mentioned you`; + return cast ? `@${cast.author.username} mentioned you` : "Someone mentioned you"; case NotificationTypeEnum.Likes: return `Received ${notification.reactions?.length} likes`; case NotificationTypeEnum.Follows: diff --git a/src/common/components/CommandPalette/index.tsx b/src/common/components/CommandPalette/index.tsx index 556bbb68..d403c118 100644 --- a/src/common/components/CommandPalette/index.tsx +++ b/src/common/components/CommandPalette/index.tsx @@ -434,7 +434,7 @@ export default function CommandPalette() { onOpenChange={toggleCommandPalette} defaultOpen > - + ); - console.log('profile', profile) + const shouldRenderFullInfo = - showFullInfo && (profile?.airstackSocialInfo || profile?.icebreakerSocialInfo); + showFullInfo && + (profile?.airstackSocialInfo || profile?.icebreakerSocialInfo); const renderIcebreakerCredentials = () => { if (!profile?.icebreakerSocialInfo?.credentials?.length) return null; @@ -91,14 +92,16 @@ const ProfileInfo = ({
Credentials
- {take(profile.icebreakerSocialInfo.credentials, 5).map((credential) => ( - - {credential.name} - - ))} + {take(profile.icebreakerSocialInfo.credentials, 5).map( + (credential) => ( + + {credential.name} + + ) + )}
); diff --git a/src/home/index.tsx b/src/home/index.tsx index 69bb042f..43a92f8d 100644 --- a/src/home/index.tsx +++ b/src/home/index.tsx @@ -177,7 +177,8 @@ const Home = ({ children }: { children: React.ReactNode }) => { ) !== -1; const isChannelFeed = selectedChannelUrl !== CUSTOM_CHANNELS.FOLLOWING && - selectedChannelUrl !== CUSTOM_CHANNELS.TRENDING; + selectedChannelUrl !== CUSTOM_CHANNELS.TRENDING && + !selectedList; const actions = [ { name: "Cast", diff --git a/src/stores/useAccountStore.ts b/src/stores/useAccountStore.ts index 28efacb8..8d303289 100644 --- a/src/stores/useAccountStore.ts +++ b/src/stores/useAccountStore.ts @@ -22,6 +22,7 @@ import uniqBy from "lodash.uniqby"; import { v4 as uuidv4 } from 'uuid'; import { getUsernameForFid } from "@/common/helpers/farcaster"; import { IndexedDBStorage } from "./StoreStorage"; +import { ArrowTrendingUpIcon, BeakerIcon, HomeIcon } from "@heroicons/react/20/solid"; const APP_FID = Number(process.env.NEXT_PUBLIC_APP_FID!); const TIMEDELTA_REHYDRATE = 1000 * 60 * 60 * 120; // 5 days; @@ -583,6 +584,7 @@ const getCommandsForPinnedChannels = (channels: ChannelType[], state) => { export const getChannelCommands = (state) => { let channelCommands: CommandType[] = [{ + icon: HomeIcon, name: `Switch to follow feed`, aliases: ['following', 'feed', 'home'], shortcut: 'shift+0', @@ -595,6 +597,7 @@ export const getChannelCommands = (state) => { page: 'feeds', }, { + icon: ArrowTrendingUpIcon, name: `Switch to trending feed`, aliases: ['trending', 'popular'], shortcut: 'shift+1', @@ -607,7 +610,8 @@ export const getChannelCommands = (state) => { page: 'feeds', }, { - name: `Switch to random channel`, + icon: BeakerIcon, + name: 'Switch to random channel', aliases: ['random', 'lucky', 'discover'], page: 'feeds', action: () => { diff --git a/yarn.lock b/yarn.lock index 233778fe..3f20d598 100644 --- a/yarn.lock +++ b/yarn.lock @@ -945,9 +945,9 @@ "@tanstack/react-virtual" "^3.8.1" "@heroicons/react@^2.0.18": - version "2.1.3" - resolved "https://registry.yarnpkg.com/@heroicons/react/-/react-2.1.3.tgz#78a2a7f504a7370283d07eabcddc7fec04f503db" - integrity sha512-fEcPfo4oN345SoqdlCDdSa4ivjaKbk0jTd+oubcgNxnNgAfzysfwWfQUr+51wigiWHQQRiZNd1Ao0M5Y3M2EGg== + version "2.1.5" + resolved "https://registry.yarnpkg.com/@heroicons/react/-/react-2.1.5.tgz#1e13f34976cc542deae92353c01c8b3d7942e9ba" + integrity sha512-FuzFN+BsHa+7OxbvAERtgBTNeZpUjgM/MIizfVkSCL2/edriN0Hx/DWRCR//aPYwO5QX/YlgLGXk+E3PcfZwjA== "@hookform/resolvers@^3.4.2": version "3.6.0"