chore: follow-up #236

This commit is contained in:
2024-10-07 15:12:30 +07:00
parent 090a815f99
commit 8c6aea8050
7 changed files with 83 additions and 81 deletions

View File

@@ -217,16 +217,16 @@ function ManageButton() {
const menuItems = await Promise.all([
MenuItem.new({
text: "Open Columns Gallery",
text: "Open Launchpad",
action: () => LumeWindow.openColumnsGallery(),
}),
PredefinedMenuItem.new({ item: "Separator" }),
MenuItem.new({
text: "Add local feeds",
text: "Open Newsfeed",
action: () => LumeWindow.openLocalFeeds(),
}),
MenuItem.new({
text: "Add notification",
text: "Open Notification",
action: () => LumeWindow.openNotification(),
}),
]);

View File

@@ -10,7 +10,7 @@ import { resolveResource } from "@tauri-apps/api/path";
import { readTextFile } from "@tauri-apps/plugin-fs";
import { useCallback } from "react";
export const Route = createLazyFileRoute("/columns/_layout/gallery")({
export const Route = createLazyFileRoute("/columns/_layout/launchpad")({
component: Screen,
});
@@ -116,7 +116,8 @@ function MyGroups() {
const renderItem = useCallback(
(item: NostrEvent) => {
const name = item.tags.filter((tag) => tag[0] === "d")[0][1] ?? "unnamed";
const name =
item.tags.find((tag) => tag[0] === "title")?.[1] || "Unnamed";
return (
<div
@@ -225,7 +226,8 @@ function MyInterests() {
const renderItem = useCallback(
(item: NostrEvent) => {
const name = item.tags.filter((tag) => tag[0] === "d")[0][1] ?? "unnamed";
const name =
item.tags.find((tag) => tag[0] === "title")?.[1] || "Unnamed";
return (
<div

View File

@@ -10,7 +10,7 @@ import { useState, useTransition } from "react";
const TOPICS = [
{
title: "Popular",
title: "Popular hashtags",
content: [
"#nostr",
"#introductions",
@@ -119,6 +119,24 @@ function Screen() {
<ScrollArea.Viewport className="bg-white dark:bg-black h-full p-3">
<div className="mb-3 flex flex-col gap-2">
<span className="text-sm font-semibold">Added</span>
<div className="flex gap-2">
<input
name="hashtag"
placeholder="#nostr"
onChange={(e) => setHashtag(e.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") addHashtag();
}}
className="w-full px-3 text-sm border-none rounded-lg h-9 bg-neutral-100 dark:bg-neutral-900 placeholder:text-neutral-600 focus:border-neutral-500 focus:ring-0 dark:placeholder:text-neutral-400"
/>
<button
type="button"
onClick={() => addHashtag()}
className="inline-flex items-center justify-center text-neutral-500 rounded-lg size-9 bg-neutral-200 dark:bg-neutral-800 shrink-0 hover:bg-blue-500 hover:text-white"
>
<Plus className="size-5" />
</button>
</div>
<div className="flex flex-col gap-2">
{hashtags.length ? (
hashtags.map((item: string) => (
@@ -139,50 +157,29 @@ function Screen() {
)}
</div>
</div>
<div className="flex flex-col gap-2">
<span className="text-sm font-semibold">Hashtags</span>
<div className="flex gap-2">
<input
name="hashtag"
placeholder="#nostr"
onChange={(e) => setHashtag(e.target.value)}
onKeyDown={(event) => {
if (event.key === "Enter") addHashtag();
}}
className="w-full px-3 text-sm border-none rounded-lg h-9 bg-neutral-100 dark:bg-neutral-900 placeholder:text-neutral-600 focus:border-neutral-500 focus:ring-0 dark:placeholder:text-neutral-400"
/>
<button
type="button"
onClick={() => addHashtag()}
className="inline-flex items-center justify-center text-neutral-500 rounded-lg size-9 bg-neutral-200 dark:bg-neutral-800 shrink-0 hover:bg-blue-500 hover:text-white"
>
<Plus className="size-5" />
</button>
</div>
<div className="mt-2 flex flex-col gap-4">
{TOPICS.map((topic) => (
<div key={topic.title} className="flex flex-col gap-2">
<div className="text-sm font-semibold">{topic.title}</div>
<div className="flex flex-wrap gap-2">
{topic.content.map((item) => (
<button
key={item}
type="button"
onClick={() => toggleHashtag(item)}
className={cn(
"text-sm p-2 rounded-full",
hashtags.includes(item)
? "bg-blue-500 text-white"
: "bg-neutral-100 dark:bg-neutral-900",
)}
>
{item}
</button>
))}
</div>
<div className="flex flex-col gap-4">
{TOPICS.map((topic) => (
<div key={topic.title} className="flex flex-col gap-2">
<div className="text-sm font-semibold">{topic.title}</div>
<div className="flex flex-wrap gap-2">
{topic.content.map((item) => (
<button
key={item}
type="button"
onClick={() => toggleHashtag(item)}
className={cn(
"text-sm p-2 rounded-full",
hashtags.includes(item)
? "bg-blue-500 text-white"
: "bg-neutral-100 dark:bg-neutral-900",
)}
>
{item}
</button>
))}
</div>
))}
</div>
</div>
))}
</div>
</ScrollArea.Viewport>
<ScrollArea.Scrollbar