Skip to content

Commit

Permalink
improve command palette
Browse files Browse the repository at this point in the history
  • Loading branch information
hellno committed Aug 21, 2024
1 parent afa1309 commit 10e2e89
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions pages/notifications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/common/components/CommandPalette/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export default function CommandPalette() {
onOpenChange={toggleCommandPalette}
defaultOpen
>
<Command shouldFilter loop>
<Command shouldFilter={false} loop>
<CommandInput
onValueChange={setQuery}
autoFocus
Expand Down
23 changes: 13 additions & 10 deletions src/common/components/Sidebar/ProfileInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ const ProfileInfo = ({
</Tooltip>
</TooltipProvider>
);
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;
Expand All @@ -91,14 +92,16 @@ const ProfileInfo = ({
<div className="mt-2">
<span className="text-sm text-foreground mb-2">Credentials</span>
<div className="flex flex-wrap gap-1">
{take(profile.icebreakerSocialInfo.credentials, 5).map((credential) => (
<span
key={`${fid}-${credential.name}`}
className="rounded-lg px-1 border border-foreground/20 text-xs text-muted-foreground flex items-center"
>
{credential.name}
</span>
))}
{take(profile.icebreakerSocialInfo.credentials, 5).map(
(credential) => (
<span
key={`${fid}-${credential.name}`}
className="rounded-lg px-1 border border-foreground/20 text-xs text-muted-foreground flex items-center"
>
{credential.name}
</span>
)
)}
</div>
</div>
);
Expand Down
3 changes: 2 additions & 1 deletion src/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/stores/useAccountStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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',
Expand All @@ -595,6 +597,7 @@ export const getChannelCommands = (state) => {
page: 'feeds',
},
{
icon: ArrowTrendingUpIcon,
name: `Switch to trending feed`,
aliases: ['trending', 'popular'],
shortcut: 'shift+1',
Expand All @@ -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: () => {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 10e2e89

Please sign in to comment.