Commit Graph

163 Commits (889a49e0ef477c19de3821f3a6092af9ab9dfaac)

Author SHA1 Message Date
OFF0 cadd0302a5
utils: cleanup and move isvalidurl to utils/url 2 years ago
OFF0 23188c161f
utils: move lock and unlock scroll functions to utils 2 years ago
OFF0 70fb0da35a
utils: import directly from utils
it is not worth to import everything from utils, as there are too
many functions, better import them directly from each module.
2 years ago
OFF0 495e755844
styles: move stylesheets to styles 2 years ago
OFF0 33dd40bae5
typescript 2 years ago
OFF0 6e404eac6b
refactor: type element attributes
use attributes of html element type.

so that the following example is correctly typed:

elem('input', {
  className: 'foo',
  hidden: false,
  onclick: () => alert('hi'),
  tabIndex: 1,
  valueAsNumber: 1,
});

but this fails as foo is no valid attribute on div element:

elem('div', {foo: 'bar'});
2 years ago
OFF0 489a260427
refactor: type elem and enforce inferred generic type
typed elem so that it returns the exact type of the HTMLElement,
and that name must be a key of HTMLElementTagNameMap.

example:

elem('form'); // returns HTMLFormElement

elem('abc'); // not assignable to parameter of type 'keyof HTMLElementTagNameMap'
2 years ago
OFF0 2d46687e12
refactor: type events.ts, url.ts and crypto.ts 2 years ago
OFF0 fa97027321
refactor: type view.ts, dom.ts and time.ts 2 years ago
OFF0 35b8baef92
refactor: type subscriptions.ts
typed subscribe functions in subscriptions.ts
2 years ago
OFF0 309367852a
routes: use nip19 as routes
so we need no guessing logic and know what to subscribe too. in a
later step it add more to the view i.e. show profile meta data for
npub.
2 years ago
OFF0 b0e190fd22
nip19: use bech32 npub and note in uris
convert pubkey to npub and event id to note and store for
later. use npub and note for uri's so that we dont need to
guess what the view of a specific uri has to render.

this is only the first step that changes uri's, next step is
for the view to react to npub or note and render the
correct view accordingly.
2 years ago
OFF0 87cd5f21b3
relays: type and upgrade to nostr-tools@1.6.0
move and typed relay related code to relays.ts

upgrade nostr-tools to latest greatest, major version with
breaking changes:

- relayPool is gone in favor of SimplePool, but this commit just
  used relayInit directly as relays should become configurable at
  some point
2 years ago
OFF0 57be701ef9
routes: use generic view containers
proof of concept to use generic view containers instead of specifc
functions to show and hide particular views.

a view has an identifier (path) which is used to subscribe to
relevant data. changing a view updates the history so that browser
back displays the last view. each view container has its own
scrollbar so that the scrolling position should be preserved when
changing back and forth between different views.

this change also removes CSS tabs in favor of view or overlays
such settings or write a new text note.

profile and notes deeplink use now native HTML anchors to improve
accessibility (copy/paste, open-in-new-tab, search engines).
2 years ago
OFF0 46bd581950
replay: temp disable overloaded relays
ci/woodpecker/push/woodpecker Pipeline was successful Details
there is currently lots of chinese spam, probably since damus was
accepted in appstore.

temporary disabled damus, snort.social and nostr.info relays, and
added some less known german and swiss relays.
2 years ago
OFF0 e84af81b97
relay: add snort.social relay
ci/woodpecker/push/woodpecker Pipeline was successful Details
relay.snort.social seems to be a popular relay, adding a new one
to the hardcoded list of relays, this should be configurable in
the future.

related damus relay is often not responding or slow, but keeping
it for now.
2 years ago
OFF0 5a18e2952c
profile: increase number of notes shown on profile
ci/woodpecker/push/woodpecker Pipeline was successful Details
there is no good reason to show less notes on a profile deeplink.
changed limit to 450, same as explore feed.
2 years ago
OFF0 593d4c6e38
relay: change wlvs.space to eden.land
ci/woodpecker/push/woodpecker Pipeline was successful Details
wss://nostr-relay.wlvs.space is not working anymore, seems they
moved, see:
- https://nostr.ch/cbb15cbd3a36a79a4611ee2852bea503f764c4d48fdb5988b1124a146efccc55
2 years ago
OFF0 339e1ed97c
feed: style 3 levels of nested threads
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
instead of just adding 1 line for all replies to point to the
original note, using smaller profile pic for replies of replies
help to understand the context of the replies.

this is done without increasing indentation as heavy nesting can
mess up the layout so only indentation is visible and the space
for the actual content gets to small.

if needed users can inspect replies and navigate to the deeplink
to see how the next 3 levels are nested.
2 years ago
OFF0 e94c9c92da
feed: sort replies by created at
replies were not sorted correctly, reason for this was that an
array of dom elements was sorted, but instead it should sort the
notes.

regression introduced in:
- 2e40a273c4
2 years ago
OFF0 0dcfa6e0a9
feed: show publish note within the same second
a fast relay might return a newly published note within the same
second, but nostrweb only shows notes that are older than now.

was introduced in 4a68940681
2 years ago
OFF0 f4f951469f
feed: less eager rendering
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
before this change every new incoming text note called a render,
that filters, sorts and iterates all known text notes and creates
missing dom elements and appends into the right place.

this change throttles and debounces (both!) the render function,
that less checks have to be performed, especially on page load
when potentially 100s of events arrive within a short time.

it is important to throttle and debounce, else either the last call
is missed or no render is called while events are being received.

this change surfaced an error in recommend server that depended on
all known text notes already being rendered and inside the dom.
this function should probably be handled by render feed itself.
2 years ago
OFF0 2e40a273c4
nip-10: fix duplicate replies in feed
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
some replies rendered twice in different positions, seems to be
related to deprecated positional event tags and a regression
introduced in a596121821

on receiving events it analizes the event tags and stores the id
of the replied event so the client can easily search for replies
later. marked tags are prefered with a fallback to positional tags
as described in nip-10.

mentions are ignored at the moment.

example event that had some replies rendered twice:
22e4ea80161ac591059da611d3ab63c583cb1d47a706826db2fc6955ac0a70b5
2 years ago
OFF0 c16ccdb4e3
nip-13: improve mining error
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
- fix error overlay colors in light-mode
- improve error text, mentoning what happend and what to do
2 years ago
OFF0 a61b54de7c
feed: fix link rendering
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
some words were incorrectly detected as links.

changed:
- split words by any whitespace character, not just char 32
- match words _beginning_ with http, https or www.

example of broken link user white space character code 160, see:
feb290999a2746bf0914ede8a811b52eccd423f9f5373232e4f5947131fb47aa
2 years ago
OFF0 8ff1d2c1d8
nip-13: check zero leading bits
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
before it was only testing if the nonce commitment is high enough
but didn't verify leading zero bits.

with this change rendering checks now the leading zero bits count
of the event id.
2 years ago
OFF0 4a68940681
feed: render only notes from the past
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
some notes have a created at field that is 1 year in the future,
these are always shown on to of the feed. changed to only render
notes that are from the past.
2 years ago
OFF0 caf5083caa
nip-13: difficulty filter
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
added a slider to adjust the difficulty filter, current default is
0 so all notes are rendered. increasing the filter will hide notes
with lower difficulty target.

changed the max difficulty from 256 to 32 for now so that the
range slider is usable.

this does not yet hide reactions with lower difficulty.
2 years ago
OFF0 a3de8f1595
feed: improve recommend server (kind 2) messages
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
- check that event.content is a valid WSS url, drop otherwise
- fix bug that rendered the same server recommendation twice
2 years ago
OFF0 37f0a07cf3
nip-13: show working msg and cancel btn while mining
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
mining often takes a few seconds. it can be confusing if nothing
happens when a user is publishing their profile, upvoting a note
or posting a new note.

added visual feedback that nostrweb is working with an option to
cancel the mining process.
2 years ago
OFF0 898e7265c2
nip-13: add settings for mining difficulty and timeout
adding settings to change mining difficulty and timeout, so users
can change or disable pow. also added some explanation and link
to nip-13.

setting arbitrary low default to 16 zero mining difficulty and
5 seconds timeout.
2 years ago
OFF0 a596121821
feed: dirty fix to show replies
now that nonce tag is always the first element in the tags list,
a bug surfaced that replies from nostrweb did not render anymore.

reason was that the code expected the first tag to be an e tag and
took its reply-id. this commit is a quick fix that takes the first
reply-id from the first e tag.

the proper way is a bit more complicated as nip-10 defines a
preferred and deprecated way.

this is a quick and dirty fix so that replies work with nip-13 pow
events, but nip-10 event tags should be properly supported but in
a later commit.
2 years ago
OFF0 d5e9ef18c7
nip-13: add timeout and show user facing error if it exceeds
mining may take a long time if the mining difficulty is high.

calculating pow for text notes, upvotes and profile meta
data now has a timeout of 10s. if the timeout exceeds a user
facing error is shown with the option to try again.

the error is currently very basic, and only displays timeout -
something went wrong, cancel and try again button.
2 years ago
OFF0 a1b1f3baee
nip-13: mine pow async in worker any only invoke noxy with pow
added pow to text notes, reactions and metadata events. pow is
mined async in a worker so that the main process does not freeze.

noxy profile images, link and image previews are now now only
invoked if an event has some valid work proof. noxy can decide
if there is enough work and whether or not to serve data for a
certain event.

target difficulty can be implemented in a later step, this change
only check if there is any valid nonce tag with commitment target
greater than 0.
2 years ago
OFF0 7edf1151a6
nip-25: use proper reacted to e and p tags
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
the actual event that is being reacted must be the last event tag,
was wrongly using the first one and displayed wrong star if tags
had more than 1 event tag.

upvoting now also includes e and p tags from the event that is
upvoted.

see also https://github.com/nostr-protocol/nips/blob/master/25.md
2 years ago
OFF0 485510314a
relays: update list of relays
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
adding damus again (was disabled when it was down and heavy spam
happened last year), remove nostr.sandwich.farm as it currently
errors with '502 Bad Gateway'.
2 years ago
OFF0 387f4de3f2
content: parse lightning addresses and render as links
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
LN addresses use too much screen real estate, render as link seems
more useful.

lightning links are words starting with the following prefix:
lnbc for Bitcoin mainnet, lntb for testnet, lntbs for signet, and
lnbcrt for regtest

https://github.com/lightning/bolts/blob/master/11-payment-encoding.md#human-readable-part
2 years ago
OFF0 d7f75f92e0
content: exlcude links to localhost
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
No good reason to link to localhost.
2 years ago
OFF0 dc664fc318
content: exclude links to ip addresses
There is no good reason to link to an ip directly.

Excluding links that look like ipv4 or ipv6.
2 years ago
alex 9b11459f2d
css: temporary disable image previews until things calm down
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
there's too much porn spam at the moment.
revert this when we find an alternative.
2 years ago
OFF0 7cec00805e
feed: increase filter limit to 450
ci/woodpecker/push/woodpecker Pipeline was successful Details
was accidentally lowered in cd99b5e5c1
2 years ago
OFF0 c88dfa03b9
relay: add new relays and temp disable relay.damus.io
relay.damus.io seems to be down, added a few alternatives.
2 years ago
OFF0 f26cb737a4
profile: fix old profile pic still showing
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
The profile image never changed until a new one is successfully
loaded. This fix clears the picture before loading a new one.
2 years ago
OFF0 cd99b5e5c1
feed: add deeplinking and browser history
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Added deeplinks with browser history support. Each note and author
have now a detail view under nostr.ch/<event-id-or-pubkey> in a
future commit also /e/<event-id> and /p/<pubkey> could be supported.

User can now navigate with browser back (with the expection of the
settings overlay).

Not everything is supported in the detail view (yet) i.e reply and
stars are partially working (dont update visually), leaving this as
open bug. This should fix itself once only 1 render container is
used instead of different divs in the html for each view.

Ideally the detail view should also query for related events,
something to add in a future commit
2 years ago
OFF0 23619bbaaa
noxy: log more useful response error 2 years ago
OFF0 44c1af2381
profile: update kind 0 name and picture
Notes often miss name or picture of authors if the note was
rendered before any metadata (kind 0) has been recieved.

Update name and picture of existing notes. Pictures are only
updated if a valid url.
2 years ago
OFF0 b86cf6f687
pwa: add manifest and related app icons
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
That nostr.ch has a pretty app icon when adding to home screen.
2 years ago
alex 343413355f
pool: add relay.nostr.ch
ci/woodpecker/push/woodpecker Pipeline was successful Details
this is another relay, so we have two to play with. this one is running
on the same machine where live nostrweb is hosted at.

at the moment, relay is running nostr-rs-relay v0.7.2:

    $ curl -H 'accept: application/nostr+json' https://relay.nostr.ch/
    {
      "id": "wss://relay.nostr.ch/",
      "name": "a nostr relay",
      "description": "just another nostr relay",
      "supported_nips": [
        1,
        2,
        9,
        11,
        12,
        15,
        16,
        20,
        22,
        26
      ],
      "software": "https://git.sr.ht/~gheartsfield/nostr-rs-relay",
      "version": "0.7.2"
    }
2 years ago
OFF0 e2431c7e60
profile: support kind 0 metadata events
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Added simple profile form to the setting view to send kind 0
metdata such as: name, about and picture.
2 years ago
OFF0 9df0f723f2
preview: dont render empty meta fields
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Metadata can contain empty fields or broken images. Improved
rendering of meta preview links with missing info, also added a
subtile transparent dark background color to preview images, as
some images contain white text on transparent background and are
invisible in light mode.
2 years ago
OFF0 ff0ba4f6e6
preview: show the full preview image
Was set to cover, which is nice but cuts off some sides,
especially since image dimensions are not known.
2 years ago
OFF0 9f992044b2
send: update layout on mobile
On mobile the keyboard covered half of the buttons, changed form
to be aligned at the top of the screen and made textarea a bit
smaller so that the mobile keyboard and the form are both visible.
2 years ago
OFF0 edbb861bf1
send: change wording, use note instead of post
In nostr we write notes, not posts no tweets just notes.
2 years ago
OFF0 b321acde02
noxy: add simple fetch queue and wait for meta data response
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Instead of just blindly fetch noxy requests, this adds a simple
fetch queue and waits until the pending response is done. It
continues with the next one in the queue  whichever seen first,
This is not in chronological order, but incoming event order
(incoming events from different relays are probably out of order).
2 years ago
OFF0 a580bc67b2
noxy: add lazy load attribute to noxy images
Only for browsers that support loading=lazy attribute, but this
should reduce the load on noxy and only fetch images that are
relevant (in the viewport of close to it).
2 years ago
OFF0 9250ccf287
preview: fix limit width of large images 2 years ago
OFF0 2d2643c2c8
feed: display link preview with noxy
fetches the first link and shows it below a text note, all
resources are prxied through noxy.

see nostr/noxy#2
2 years ago
OFF0 0047c0bdc0
settings: document code on when exactly the pubkey is regenerated
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
The pubkey should not always be regenerated when a privatekey is
pasted. The reason is that on paste event is fired before the
privateKeyInput value is updated.

Added code comments on when the condition passes and should be save
to re-generate the pubkey.
2 years ago
OFF0 d8f71b74ec
send: hide new message afer successful send
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
The write new text note form should be hidden after successful send.
2 years ago
alex be5e88661e
about: link to the original write up on nostr protocol
ci/woodpecker/push/woodpecker Pipeline was successful Details
updates #3
2 years ago
OFF0 96087dc041
feed: fix multiple upvotes (reactions)
ci/woodpecker/push/woodpecker Pipeline was successful Details
Fixes error when upvoting already starred events.

Now the tooltip should display the reactions again.
2 years ago
OFF0 71945b105f
settings: pasting private key should update pubkey
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
If the user pastes a private-key and the pubkey field is empty,
it should be ok to generate and autofill the pubkey without
confusing the user. There might be circumstances where it is
preferred to see an error if the pubkey does not correspond with
the private key.

Added an on paste event listener that tries to generate and auto-
fill the pubkey (if empty).

Also disabled autocomplete on the settings form to indicate to not
save the key in password manager.
2 years ago
OFF0 8ec9420be8
feed: render links in text notes
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Links should be rendered as anchors so that they are clickable.
For now only links starting with http:// https:// or www. are
supported.

Temporary disabled text notes shortening.
2 years ago
OFF0 ec9945cf05
feed: reduce newlines in text notes
This change reduces 3 or more newlines to 2 to keep the output
somewhat sane, i.e. somebody spamming newlines.
2 years ago
OFF0 9711ca2ecf feed: refactor profile image placeholder
ci/woodpecker/push/woodpecker Pipeline was successful Details
Move canvas placeholder image to getMetadata so that the logic is
in one place. Also added an exception for pubkeys starting with
at least 6 zeros to invert the color.
2 years ago
OFF0 d8c087bb71
about: link to and from the about page
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
The about page was not linked, added footer section on the settings
view to link to the about page. Also added a link from the about
page to link back to index.html.
2 years ago
alex e238bd9018
add an about page
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
this is a simple static text page showing current version from
the npm package and git commit hash at which the app was built.

it's served at /about.html but i didn't link it from the root.
not sure where the best place is.
2 years ago
OFF0 11fbc7aa7d
feed: ability to close reply form
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
This is an approach to close the reply-to-form automatically when
focus is lost and only if the input is empty. A second way to close
the reply-to-form is provided by toggling the reply icon.
2 years ago
OFF0 16eb14d08e
layout: add dummy profile pic to recommend server
ci/woodpecker/push/woodpecker Pipeline was successful Details
Recommend server events looked broken and still showed the old
bubble. Fixed layout and also use dummy pic for recommend server
events.
2 years ago
OFF0 2e94d59028
feed: fix expand long notes
Text notes longer than 280 are shortened and appended with '…' to
indicate that this note can be expanded, but this dotdotdot was
real text and was not removed once the note is expanded.

Changed to showing the dots through CSS and only if the attribute
exists, so it does not show on expanded notes.
2 years ago
OFF0 b4392bf215
layout: highlight kind 0 name and dummy profile pics
- added experimental dummy profile pics
- highlight kind 0 usernames
- improved dark mode colors
2 years ago
OFF0 fecbb8ff50
feed: show picture (kind 0) with noyx
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Loading images from random url leaks meta data to other servers.

Enabled showing kind 0 picture from noxy (nostr proxy),
see https://git.qcode.ch/nostr/noxy

Only href that are a valid url and use http(s) should be allowed
to prevent malicious urls such as 'javascript:alert(1)'.

Kept the fallback to the speak bubble if there is no kind 0 event
for this pubkey or picture is missing.
2 years ago
OFF0 6a4266526d
keys: fix key validation
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Pub and private key settings only showed errors if both values were
truthy, but it did not validate if one input was falsy, in which
case it only showed the last error.

Removed truthy check as it is not needed.
2 years ago
OFF0 4dd8dae483
layout: fix nav positioning on ios
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
Safari does not take the addressbar into account when using 100vh,
this is the cauase that the navigation is sometimes hidden when
the user scrolls up/down.

changed to 100dvh with fallback to 100vh.
2 years ago
OFF0 4576355b03
layout: visual interface improvements
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details
- writing a new message is now presented in full-screen, so that
  there are no distractions, i.e. other posts
- added back button and listen to esc key to close new message
- on portrait mode the navigation buttons are now positioned at
  the bottom of the screen
- write new message botton (bubble) is also positioned bottomright
- replies now use a line to the last reply instead of indentation,
  better use of available space, especially on small screen
- ignore newlines at the end of a post
- added subtile growin effect to the multiline textfield, to hint
  that the textarea is growing with more content
2 years ago
OFF0 3ab815c30e
post: remove whitespace of textnote content (trim right only)
Send button should be disabled if there are only white spaces or
newlines, trimming only right as white spaces at the beginning
could mean somethig i.e in markdown.
2 years ago
OFF0 8081d12254
post: disable input field resizing
Textarea can be resized manually, but this does play well
with the automatic resizing (yet), disabling for now.
2 years ago
OFF0 7d9f31f7c6
refactor: use evt as variable name if possible
This was we can use evt.id consistently instead of mental overhead
of textNoteEvent.id
2 years ago
OFF0 06686ba9a7
post: improve write and reply to textnote usability
- use growing textarea input to support multiline textnotes
- keep replyTo id in localstorage instead of global variable
- render reply to form on load if there was a replyTo in storage
2 years ago
OFF0 b10a63b932
comment code about textNoteList and eventRelayMap 2 years ago
OFF0 e9cc165738
utils: move multiline function to domutils 2 years ago
OFF0 409ff80d64
test multiline comments 2 years ago
OFF0 7b7b4d3f28
use nostr x1ddos only for now 2 years ago
OFF0 730db777b6
refactor: rename form to settingsform 2 years ago
OFF0 8109a22bb8
style: make page mobile friendly 2 years ago
OFF0 4a710ee5d1
getting ready
- added favicon.ico to get rid of anoying logs in the future
- clicking the idea bubble brings back the text input field
- stop accidentally submitting the reply form
- updated idea cloud to dark/light mode neutral gray
- contact list not needed yet, disabled
- add a detailed list of reactions in star tooltip
- removed debug debounce was for testing chronological feed order
- started username prototype
2 years ago
OFF0 e7ad8e468b
feed: handle reactions (kind 7)
Added support for starring.

Stores recation events in a reactionMap, so rendering can use it
later.

Improved reply to replies, by keeping a separate replyDomMap.

Changed from heart to star, reason: thumbsup or a heart are good
for positive events, but not so suitable to react to a bad event.
So currently negavtive votes are just counted as a star as well.

Did not add another dom map, but just querySelector in case an
existing star needs to be updated later.
2 years ago
OFF0 13b3db4302
layout: update navigation and add icons
Used different CSS-only tab technique. The implementation before
messed up the whole height of the page and used unnecessary
absolute positioning.

Added comment icon from MFG Labs iconset (SIL)
- https://github.com/MfgLabs/mfglabs-iconset

Added outlined and filled heart from Elusiv icons (SIL)
- https://github.com/dovy/elusive-iconfont

Time ago seconds should be rounded.
2 years ago
OFF0 a71de21302
feed: playing with ui
- shorten text notes after 280 chars
- add expand button to shortened text
- play around with profile image and username layout
2 years ago
OFF0 c896789ccd
settings: prevent accidental form data submitting in html mode
If JavaScript is disabled the form in the settings should not leak
private or pubkey data.
2 years ago
OFF0 2d8e60a6df
feed: support reply and render incoming replies
Keeping current reply info so it can be accessed later to
publish the reply.

Before only known replies were rendered, now incoming replies
get added to the existing text note  instantly. This needs to
create a reply container if this is the first reply of this event.

Added time ago formatting and a helper function that switches
between relative time (if event < 24h) or absolute formatted time
(if older than 1 day).
2 years ago
OFF0 397df6d5a4
feed: show replies
Render known replies, also added debounce debug info to test
chronological order and keep an eye on.
2 years ago
OFF0 80a9e82f79
refactor: name sort by created_at function 2 years ago
OFF0 a2a5cfa341
refactoring: eleanup part I
Styled profile image to be aligned at the top together with the
event metadata and content.

Still need to decide on which relays to enable.

JavaScript lint fixes.
2 years ago
OFF0 b2ad1d4c60
enable send
Send is enabled now, but some errors do not surface, for exmaple
if the network is down, tried catching those but will need to dig
deeper into that.
2 years ago
OFF0 09bb691f6c
feed: refactoring and deterministic chronological feed order (maybe)
chronological order: Getting there..

cleanup: removed debounce code for now

keep also recommend server events in the dom map, not sure if just
everything should be in the map.
2 years ago
OFF0 549bfed7dd
feed: render textnotes from multiple relays in chronological order
Events should be ordered by created_at.

The randomly incoming events should be injected to their closest
event sibling. Keeping a map of eventIds and dom nodes to reference
and inject the new events.

An alternative to keeping a map could be to add a data-attribute
to each event and use querySelector. It is a trade-off os using
more memory in order to not query the dom tree.
2 years ago
OFF0 d2a7f4a603
refactor: just moving helper functions around 2 years ago
OFF0 d5fa2f420b
feed: add formatted absolute time
Useful to see when a text note was written.
2 years ago
OFF0 5d701c8767
utils: append string child directly
Strings can be appended directly without spreading.
2 years ago