Commit Graph

103 Commits

Author SHA1 Message Date
William Casarin
1f149aec3b fix clippy warnings
Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-19 21:26:20 -07:00
William Casarin
579b47fc40 selectable text option
Add a selectable text option to various note views. We don't want
selection events to interfere with back drag, so this is the first step
toward ensure back drag works.

Vertical scrollviews also interfere with back drag, so we'll still need
a way to compose gestures. It's not clear if this is currently possibly
with egui (union of responses somehow maybe?)

Signed-off-by: William Casarin <jb55@jb55.com>
2024-08-12 14:21:29 -07:00
William Casarin
c3fc4e09e8 thread: fix ordering and duplication bugs
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:55:06 -07:00
William Casarin
dd9f41b04a threads: ensure we always handle bar results
We were not handling it in ThreadView, now we do.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
593df9145b threads: check for new notes locally when thread is re-opened
We have a NoteRef cache for threads in memory, which is just a list of
NoteKeys and timestamps.

When reopening a thread, query the local DB to see if there are any new
notes that we might have missed because we weren't actively subscribed
to them.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
5be6b1ca68 ui: move timeline view to its own file
Also add some thread methods for fetching new notes

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
a28db5d330 local thread subscriptions
This adds local nostrdb thread subscriptions. When navigating to a
thread, we first check to see if we have any active nostrdb
subscriptions for that thread. If not, we create a new subscription. If
we do, we re-use that subscription.

This works by storing thread state in the Threads struct in the Damus
application state.

When we pop a route, we check to see if its a thread route. If it is,
then we try to unsubscribe, but only if that is the last remaining
subscriber for that thread, as there could be more than one.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
33e5b6886b threads: add initial thread support
This is a really dumb and broken version of threads, but it will be our
foundation for future changes.

All it currently does is load whatever notes we have locally for a
thread in chronological order. It currently does not open any
subscriptions. It is not clear what is replying to what, but hey, its a
start.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
1024affdbd actionbar: add thread button for testing
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-31 13:51:24 -07:00
William Casarin
c007cbd4f2 preview: add scroll to profile pic demo
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-28 13:40:42 -05:00
William Casarin
196535ce84 anim: add hover_expand_small
I though I would need this, but I didn't end up using it. Keep it here
anyways for now

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-16 12:54:45 -07:00
William Casarin
66c8973edf actionbar: move BarAction and add execute method
We will be executing baractions in multiple places, so factor this
out.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-16 12:54:32 -07:00
William Casarin
af8d7d222c Add note wide mode for reposts
This adds a 'wide' note design for note previews. This is a mode
where the note contents does not have padding at the start. This makes
notes previews a bit nicer.

Screenshot: https://cdn.jb55.com/s/84271f386d564c34.png
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-10 10:56:15 -07:00
William Casarin
61bc9d9919 refactor: rename ui::Note to ui::NoteView
Easier to jump to when using tags.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-10 09:56:16 -07:00
William Casarin
239a2cb701 Switch to egui master to fix wgpu issues
There are some wgpu issues that are fixed in egui-master, so
let's switch to that.

This fixes notedeck so that it runs on both my intel graphics laptop
and amdgpu desktop.

Fixes: https://github.com/damus-io/notedeck/issues/28
Fixes: https://github.com/damus-io/notedeck/issues/42
Fixes: https://github.com/damus-io/notedeck/issues/141
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-02 17:48:18 -07:00
William Casarin
724042b700 allow missing profiles in account switcher
Fixes: https://github.com/damus-io/notedeck/issues/119
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-02 10:34:42 -07:00
William Casarin
e9da25266a enable nip10 replies
you can now reply to notes

Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 19:22:43 -07:00
William Casarin
4c490e1436 Merge 'impl linux credential storage' #115
From PR description:

See the test_basic() test in linux_key_storage.rs. I ran it successfully
on my MacOS machine and a linux VM. The BasicFileStorage impl just
stores each Keypair as a SerializableKeypair json object with the file
name as the public key hex in ~/.notedeck_credentials. The
SerializableKeypair uses the nip49 EncryptedSecretKey, but we just use
an empty string as the password for now.

The BasicFileStorage impl works in MacOS, but it only conditionally
compiles to linux for simplicity.

pub enum KeyStorageResponse<R> {
    Waiting,
    ReceivedResult(Result<R, KeyStorageError>),
}

This is used as a response so that it's possible for the storage impl to
be async, since secret_service is async. It seems that secret_service
would allow for a more robust linux key storage impl so I went ahead and
made the API compatible with an async impl.

* kernelkind (1):
      impl linux credential storage
2024-07-01 10:49:15 -07:00
William Casarin
3fc73bb601 post: full available width
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 07:31:29 -07:00
William Casarin
a04df88ff6 initial note posting
Signed-off-by: William Casarin <jb55@jb55.com>
2024-07-01 06:49:12 -07:00
William Casarin
26c4d90be3 initial postbox for testing
not sure if we want to put this here yet, but it matches the design
and will be useful for testing

Fixes: https://github.com/damus-io/notedeck/issues/110
Suggested-by: Rob
2024-06-25 14:08:56 -05:00
William Casarin
a6856867a9 Merge remote-tracking branch 'pr/107' 2024-06-25 13:20:56 -05:00
William Casarin
8ef6534981 fixed_window: fix clippy warning
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 17:12:24 -07:00
William Casarin
1228f83e50 refactor: move fixed_window to ui
This is a ui module

Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 17:11:01 -07:00
William Casarin
b14a2bf254 popup: simplify borrow
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 17:09:07 -07:00
William Casarin
a66b467cb4 hide navigation title on global nav
Fixes: https://github.com/damus-io/notedeck/issues/109
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 16:47:35 -07:00
William Casarin
a9a07b3805 refactor: use map instead of explicit if let
We also use last instead of first, because the last route should be the
active one.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 14:55:43 -07:00
William Casarin
677c217ecd popup: increase fixed window margin
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-24 14:55:22 -07:00
kernelkind
6afb618089 reintroduce account management
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-23 20:04:00 -04:00
William Casarin
0b3d6f7e37 initial post reply view
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-21 14:01:40 -07:00
William Casarin
ac0821db79 postbox: add focus shadow from figma
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-21 10:14:34 -07:00
William Casarin
b0c5d2a2c5 postbox: add focused state
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-21 09:01:14 -07:00
William Casarin
18d5d95ef9 fix postbox design
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-20 13:44:35 -07:00
William Casarin
bb6c68e05c clippy postbox cleanups
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-20 13:05:57 -07:00
kernelkind
98a61c0aa7 reintroduce account switcher
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-06-18 19:16:11 -04:00
William Casarin
1458498131 initial post box view
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-17 16:21:46 -07:00
William Casarin
577aa76ac7 add --light lightmode flag to previews and notedeck
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-14 11:12:16 -07:00
William Casarin
7f37f1e9d3 perf: don't clone bytes via a more specialized function
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-13 12:49:22 -07:00
William Casarin
c4e0c710c9 actionbar: remove border on reply button, add expand animation
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-13 09:36:53 -07:00
William Casarin
db1642bc31 remove useless struct
we can just use tuples for compound ids

Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-13 09:10:31 -07:00
William Casarin
5100070b24 fix colors again
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-11 18:44:40 -07:00
William Casarin
24d400d5aa small inline preview pfps
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-11 17:50:15 -07:00
William Casarin
0dd33c90e7 initial navigation 2024-06-11 17:50:09 -07:00
William Casarin
bff0f3f628 fix inline note preview colors
Signed-off-by: William Casarin <jb55@jb55.com>
2024-06-11 16:10:18 -07:00
William Casarin
6e69407224 cleanups 2024-05-31 01:08:45 -05:00
William Casarin
2305f1e50a mobile: make mobile flag runtime-configurable
we need to pass a few more things around but it's not that bad. This
will allow you to launch damus with --mobile for mobile testing without
recompilation.
2024-05-31 01:05:53 -05:00
William Casarin
92ce718e8b side_panel: return more detailed side panel responses
We should be treating all ui widgets as pure functions that do not
mutate anything. This will make testing easier, as well as avoiding
shared mutable references.

Signed-off-by: William Casarin <jb55@jb55.com>
2024-05-28 15:09:19 -07:00
William Casarin
31b2b5c950 initial refactor in preparation for routing
Signed-off-by: William Casarin <jb55@jb55.com>
2024-05-28 15:09:01 -07:00
kernelkind
df0377cb89 Pfp integration to side panel
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-05-27 10:48:28 -07:00
kernelkind
7ebd694f11 refactor account switcher & management previews
Signed-off-by: kernelkind <kernelkind@gmail.com>
2024-05-27 10:48:28 -07:00