Skip to content

Commit 8087fee

Browse files
committed
finish description reddit unread comments
1 parent dcf7444 commit 8087fee

File tree

2 files changed

+21
-6
lines changed
  • docs/working-notes
  • src/content/project/2024/05-06-reddit-unread-comments

2 files changed

+21
-6
lines changed

docs/working-notes/todo4.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ git checkout feat/tailwind4-v2
5555
astro markdown link in new tab
5656
mdx not formatting, prettierignore, breaks them
5757
for screenshots use new not private window and select window in screenshot tool, not screen or selection, hide dock for 16/9 // important
58+
breadcrumb navigation, projects
5859
```
5960

6061

src/content/project/2024/05-06-reddit-unread-comments/index.mdx

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Reddit unread comments
3-
description: Browser extension for comments on Reddit.
3+
description: Browser extension for easier tracking of new comments on Reddit.
44
heroImage: '../../../../content/project/2024/05-06-reddit-unread-comments/_images/reddit-unread-comments.png'
55
heroAlt: Reddit unread comments browser extension
66
publishDate: 2024-05-06
@@ -21,23 +21,37 @@ Chrome/Firefox extension for easier tracking of new comments on Reddit.
2121

2222
## Goal
2323

24-
Build a custom blog script for my personal coding blog.
24+
Get practical experience in building browser extensions. Work with low level browser API's.
2525

2626
## Tech stack
2727

28-
- Browser extension, React, RadixUI, Typescript
28+
- Browser extension, React, Typescript, IndexedDB
29+
- RadixUI, React Hook Form, TailwindCSS
2930

3031
## Features
3132

32-
- Static Astro website
33+
- Highlight unread comments by visit and by time.
34+
- State between popup UI and Reddit DOM is synced in realtime.
35+
- Limit IndexedDB size by deleting oldest entries.
3336

3437
## Implementation details
3538

36-
You can find more implementation details in the <Link href="https://github.com/nemanjam/reddit-unread-comments#documentation" variant="markdown" target="_blank" title="Documentation">Documentation</Link> section on Github.
39+
The app heavily relies on proper event handling, first of all debounced `onScroll`, but also `onLoad` and `visibilitychange` events. For all DOM manipulations it uses native `document.querySelectorAll()` without any declarative framework. Reddit uses shadow DOM which is an additional challenge for querying. I used closures to store state to save performance in loops for traversing nodes.
40+
41+
The popup UI is built with RadixUI components and React Hook Form. Tailwind preflight styles are disabled to prevent interfering with Reddit styles. I implemented a messaging system for communication between the popup and the content script.
42+
43+
All state is persisted in IndexedDB database that is limited to 1MB usage. Firefox build uses manifest v2 and Chrome manifest v3.
44+
45+
You can find more implementation details in the <Link href="https://github.com/nemanjam/reddit-unread-comments/blob/main/docs/developers-note.md" variant="markdown" target="_blank" title="Documentation">docs/developers-note.md</Link> file on Github.
3746

3847
## Lessons learned
3948

40-
- Currently Astro is the best framework for building static websites.
49+
- People often do not have a habit to use browser extensions, it is challenging to get users.
50+
- A solid and up-to-date extension boilerplate project might not be available and it is crucial for success.
51+
- It can be challenging to support both v2 and v3 manifests.
52+
- A proper retry base functionality is required for a reliable DOM traversing.
53+
- Websites often update DOM, keeping extension up-to-date requires time and energy.
54+
- IndexedDB has non-ergonomic API, use wrapper library instead.
4155

4256
## Links
4357

0 commit comments

Comments
 (0)