minor updates

This commit is contained in:
Ren Amamiya
2023-06-18 11:24:57 +07:00
parent 3cc24dc8c1
commit 7ec284d4a5
15 changed files with 174 additions and 164 deletions

View File

@@ -2,7 +2,7 @@ export function Page() {
return (
<div className="flex flex-col justify-between h-full w-full">
<div className="w-full h-full flex flex-col justify-center items-center gap-4 overflow-hidden">
<h1 className="animate-moveBg bg-gradient-to-r from-fuchsia-400 via-green-200 to-orange-400 bg-clip-text text-5xl font-bold leading-none text-transparent">
<h1 className="text-white text-5xl font-bold leading-none text-transparent">
Preserve your freedom
</h1>
<div className="mt-4 flex flex-col gap-1.5">

View File

@@ -107,7 +107,7 @@ export function Page() {
async function fetchChannelMessages() {
try {
const ids = [];
const channels: any = await getChannels(10, 0);
const channels: any = await getChannels();
channels.forEach((channel) => {
ids.push(channel.event_id);
});

View File

@@ -56,7 +56,7 @@ export function FeedBlock({ params }: { params: any }) {
}, [notes.length, rowVirtualizer.getVirtualItems()]);
return (
<div className="shrink-0 w-[420px] border-r border-zinc-900">
<div className="shrink-0 w-[400px] border-r border-zinc-900">
<div
data-tauri-drag-region
className="h-11 w-full flex items-center justify-between px-3 border-b border-zinc-900"

View File

@@ -103,7 +103,7 @@ export function FollowingBlock({ block }: { block: number }) {
};
return (
<div className="shrink-0 w-[420px] border-r border-zinc-900">
<div className="shrink-0 w-[400px] border-r border-zinc-900">
<div
data-tauri-drag-region
className="h-11 w-full inline-flex items-center justify-center border-b border-zinc-900"

View File

@@ -10,7 +10,7 @@ export function ImageBlock({ params }: { params: any }) {
};
return (
<div className="shrink-0 w-[360px] flex-col flex border-r border-zinc-900">
<div className="shrink-0 w-[350px] flex-col flex border-r border-zinc-900">
<div
data-tauri-drag-region
className="h-11 w-full flex items-center justify-between px-3 border-b border-zinc-900"

View File

@@ -23,7 +23,7 @@ export function ThreadBlock({ params }: { params: any }) {
};
return (
<div className="shrink-0 w-[420px] border-r border-zinc-900">
<div className="shrink-0 w-[400px] border-r border-zinc-900">
<div
data-tauri-drag-region
className="h-11 w-full flex items-center justify-between px-3 border-b border-zinc-900"

View File

@@ -262,11 +262,9 @@ export async function createReplyNote(
}
// get all channels
export async function getChannels(limit: number, offset: number) {
export async function getChannels() {
const db = await connect();
return await db.select(
`SELECT * FROM channels ORDER BY created_at DESC LIMIT "${limit}" OFFSET "${offset}";`,
);
return await db.select("SELECT * FROM channels ORDER BY created_at DESC;");
}
// get channel by id

View File

@@ -11,7 +11,7 @@ export function Kind1({
return (
<>
<div className="select-text whitespace-pre-line break-words text-base text-zinc-100">
{truncate ? truncateContent(content.parsed, 120) : content.parsed}
{truncate ? truncateContent(content.original, 100) : content.parsed}
</div>
{Array.isArray(content.images) && content.images.length ? (
<ImagePreview urls={content.images} />

View File

@@ -28,7 +28,7 @@ export function LinkPreview({ urls }: { urls: string[] }) {
<Image
src={data["og:image"]}
alt={urls[0]}
className="w-full h-auto object-cover rounded-t-lg"
className="w-full h-44 object-cover rounded-t-lg bg-white"
/>
)}
<div className="flex flex-col gap-2 px-3 py-3">

View File

@@ -21,7 +21,11 @@ export function User({
const avatarHeight = size === "small" ? "h-6" : "h-11";
return (
<Popover className="relative flex items-start gap-3">
<Popover
className={`relative flex gap-3 ${
size === "small" ? "items-center" : "items-start"
}`}
>
<Popover.Button
className={`${avatarWidth} ${avatarHeight} shrink-0 overflow-hidden rounded-md bg-zinc-900`}
>
@@ -32,7 +36,11 @@ export function User({
/>
</Popover.Button>
<div className="flex flex-wrap items-baseline gap-1">
<h5 className="text-zinc-200 max-w-[10rem] font-medium leading-none truncate">
<h5
className={`text-zinc-200 font-medium leading-none truncate ${
size === "small" ? "max-w-[7rem]" : "max-w-[10rem]"
}`}
>
{user?.nip05 || user?.name || shortenKey(pubkey)}
</h5>
{repost && (

View File

@@ -11,7 +11,7 @@ export const useChannels = create(
immer((set) => ({
channels: [],
fetch: async () => {
const response = await getChannels(10, 0);
const response = await getChannels();
set({ channels: response });
},
add: (event) => {

View File

@@ -1,16 +1,12 @@
export const APP_VERSION = "1.0.0";
export const DEFAULT_AVATAR = "https://void.cat/d/KmypFh2fBdYCEvyJrPiN89.webp";
export const DEFAULT_CHANNEL_BANNER =
"https://bafybeiacwit7hjmdefqggxqtgh6ht5dhth7ndptwn2msl5kpkodudsr7py.ipfs.w3s.link/banner-1.jpg";
export const DEFAULT_AVATAR = "https://void.cat/d/PZcdCxNc24rCCxV8QXbdFQ";
export const OPENGRAPH_KEY = "9EJG4SY-19Q4M5J-H8R29C9-091XPCC";
export const FULL_RELAYS = [
"wss://welcome.nostr.wine",
"wss://relay.nostr.band",
"wss://relay.damus.io",
"wss://relay.nostr.band/all",
"wss://relay.nostrich.land",
"wss://nostr.mutinywallet.com",
"wss://relay.nostrgraph.net",
];

View File

@@ -3,7 +3,7 @@ import destr from "destr";
import { nip19 } from "nostr-tools";
export function truncateContent(str, n) {
return str.length > n ? `${str.slice(0, n - 1)}&hellip;` : str;
return str.length > n ? `${str.slice(0, n - 1)}...` : str;
}
export function setToArray(tags: any) {