From 8bd983e531576e199bbb875167e27dcd99726c60 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 2 Aug 2023 11:50:23 -0700 Subject: [PATCH] Fix person detail layout on small screens --- ROADMAP.md | 17 +++++------------ package.json | 2 +- src/app/TopNav.svelte | 7 ++++--- src/app/shared/NoteContentQuote.svelte | 2 +- src/app/shared/PersonAbout.svelte | 2 +- src/app/shared/PersonNotes.svelte | 3 +-- src/app/shared/PersonStats.svelte | 2 +- src/app/views/Notification.svelte | 2 +- src/app/views/PersonDetail.svelte | 25 +++++++++++++++++-------- src/engine/components/Settings.ts | 8 ++++++-- src/engine/util/FeedLoader.ts | 11 ++++++----- tailwind.config.cjs | 8 ++++++++ yarn.lock | Bin 280749 -> 280749 bytes 13 files changed, 52 insertions(+), 37 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index a16e6751..4f4ac879 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,20 +1,12 @@ # Current -- [ ] Fix person detail on small screens -- [ ] Fork and white label blowater -- [ ] Add relayset support with kind 30022 -- [ ] White-labeled - - [ ] Add invite code registration for relay - - [ ] Add endpoint to nostream that updates whitelist - - [ ] Show invite code somewhere so users can share it. - - [ ] Use a signed string so it's based on pubkey? - - [ ] Nostream is public-read, apply registration to reads as well - - [ ] Avoid leaking events from private relays -- [ ] Image classification - - https://github.com/bhky/opennsfw2 # Core +- [ ] Fork and white label blowater +- [ ] Fix uploads + - Monetize, classify, or out source + - https://github.com/bhky/opennsfw2 - [ ] Push notifications https://web.dev/notifications/ - [ ] Put chat in window - [ ] Private groups @@ -26,6 +18,7 @@ - [ ] Reminders for max time spent on coracle - [ ] Proxy handle requests for CORS - [ ] Low data mode that hides counts on notes +- [ ] Add relayset support with kind 30022 - [ ] Show npubs/nip05 when mentioning - nevent1qqswv0ztgm8z6zeqmd0pzvwss7fzny675dx9lkqvr4zw0d9ad59eh3gpzemhxue69uhhyetvv9ujumn0wd68ytnzv9hxg6k804t - [ ] Support server-rendered link previews diff --git a/package.json b/package.json index 34796efa..d1a18a02 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "marked": "^5.1.0", "nostr-tools": "^1.12.1", "npm-run-all": "^4.1.5", - "paravel": "^0.2.0", + "paravel": "^0.2.1", "qr-scanner": "^1.4.2", "qrcode": "^1.5.1", "ramda": "^0.28.0", diff --git a/src/app/TopNav.svelte b/src/app/TopNav.svelte index 84c79811..27e1940d 100644 --- a/src/app/TopNav.svelte +++ b/src/app/TopNav.svelte @@ -88,20 +88,21 @@ if (isHex(entity)) { navigate("/" + nip19.npubEncode(entity)) + hideSearch() } else if (entity.includes("@")) { let profile = await nip05.queryProfile(entity) if (profile) { navigate("/" + nip19.nprofileEncode(profile)) + hideSearch() } } else { tryFunc(() => { nip19.decode(entity) navigate("/" + entity) + hideSearch() }) } - - hideSearch() } const topicOptions = engine.Content.topics.derived( @@ -223,7 +224,7 @@
-
+
{#if loading}
diff --git a/src/app/shared/PersonAbout.svelte b/src/app/shared/PersonAbout.svelte index a7328da2..655a873d 100644 --- a/src/app/shared/PersonAbout.svelte +++ b/src/app/shared/PersonAbout.svelte @@ -12,7 +12,7 @@ const content = parseContent({content: truncate ? ellipsize(about, 140) : about}) -

+

{#each content as { type, value }} {#if type === "newline"} {#each value as _} diff --git a/src/app/shared/PersonNotes.svelte b/src/app/shared/PersonNotes.svelte index f50ce99f..e31cdaf8 100644 --- a/src/app/shared/PersonNotes.svelte +++ b/src/app/shared/PersonNotes.svelte @@ -4,9 +4,8 @@ export let pubkey export let relays - export let invertColors = false const filter = {kinds: noteKinds, authors: [pubkey]} - + diff --git a/src/app/shared/PersonStats.svelte b/src/app/shared/PersonStats.svelte index 0f574cc2..c98cf768 100644 --- a/src/app/shared/PersonStats.svelte +++ b/src/app/shared/PersonStats.svelte @@ -56,7 +56,7 @@ -

- +
diff --git a/src/app/views/PersonDetail.svelte b/src/app/views/PersonDetail.svelte index 48ea07e3..e7b28528 100644 --- a/src/app/views/PersonDetail.svelte +++ b/src/app/views/PersonDetail.svelte @@ -51,17 +51,26 @@
- -
-
-
+ +
+
+
- + +
+ +
+
+ +
+ +
+ +
-
- -
diff --git a/src/engine/components/Settings.ts b/src/engine/components/Settings.ts index e6a78016..9d2c56ea 100644 --- a/src/engine/components/Settings.ts +++ b/src/engine/components/Settings.ts @@ -12,7 +12,11 @@ export class Settings { imgproxy = (url: string, {w = 640, h = 1024} = {}) => { const base = this.getSetting("imgproxy_url") - return base && url ? `${base}/x/s:${w}:${h}/${btoa(url)}` : url + try { + return base && url ? `${base}/x/s:${w}:${h}/${btoa(url)}` : url + } catch(e) { + return url + } } dufflepud = (path: string) => `${this.getSetting("dufflepud_url")}/${path}` @@ -22,7 +26,7 @@ export class Settings { this.settings = writable>({ last_updated: 0, - relay_limit: 10, + relay_limit: 5, default_zap: 21, show_media: true, report_analytics: true, diff --git a/src/engine/util/FeedLoader.ts b/src/engine/util/FeedLoader.ts index ec2f63c8..d6e75f64 100644 --- a/src/engine/util/FeedLoader.ts +++ b/src/engine/util/FeedLoader.ts @@ -1,4 +1,4 @@ -import {partition, uniqBy, pluck, sortBy, without, any, prop, assoc} from "ramda" +import {partition, identity, uniqBy, pluck, sortBy, without, any, prop, assoc} from "ramda" import {ensurePlural, seconds, doPipe, throttle, batch} from "hurdak" import {now, race} from "src/util/misc" import {findReplyId} from "src/util/nostr" @@ -107,9 +107,10 @@ export class FeedLoader { addToFeed = (notes: Event[]) => { this.feed.update($feed => { // Avoid showing the same note twice, even if it's once as a parent and once as a child - const feedIds = new Set(pluck("id", $feed)) - // Maybe this? - // const feedIds = new Set(pluck("id", $feed).concat($feed.concat(notes).map(findReplyId).filter(identity))) + const feedIds = pluck("id", $feed) + const feedParentIds = $feed.map(findReplyId).filter(identity) + const noteParentIds = notes.map(findReplyId).filter(identity) + const ids = new Set([...feedIds, ...feedParentIds, ...noteParentIds]) return uniqBy( prop("id"), @@ -117,7 +118,7 @@ export class FeedLoader { this.context.applyContext( sortBy( e => -e.created_at, - notes.filter(e => !feedIds.has(findReplyId(e))) + notes.filter(e => !ids.has(findReplyId(e))) ), true ) diff --git a/tailwind.config.cjs b/tailwind.config.cjs index 77ac1ed7..18518491 100644 --- a/tailwind.config.cjs +++ b/tailwind.config.cjs @@ -4,6 +4,14 @@ module.exports = { safelist: ["w-4", "h-4"], theme: { extend: {}, + screens: { + xs: "400px", + sm: "640px", + md: "768px", + lg: "1024px", + xl: "1280px", + "2xl": "1536px", + }, colors: { transparent: "var(--transparent)", black: "var(--black)", diff --git a/yarn.lock b/yarn.lock index ee31b3cfb18e995392be2c6983b888e4a4546bd6..ea9456bba1ea90d6557d6c854497c0443ea6bf99 100644 GIT binary patch delta 180 zcmZ2GQE=@lSI3j67zO5C6;nE0AesU`v3p{ delta 180 zcmZ2GQE=@#KOcfDap`0 z)hxw0Eiu*DATiAVD41xHY?^FrYLIA=k~CdVkx?wfJ1HzQIVHl_Fg>C$BH7hFF*8%& z%-JWvKiDkWtTNv@EV3x2%GD<{$h|n##oetSF~Be~%iX{`(xuEjBh@TQJF>vguQb51 fuqZpIq|&#@qO{0)df`%L$#!!k=I!Q6EM;l{B#${G