Skip to content

Commit f55d5c1

Browse files
committed
feat: specify the number of posts to bookmark instead of number of posts to read
1 parent ddba4a8 commit f55d5c1

File tree

7 files changed

+17
-17
lines changed

7 files changed

+17
-17
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "x-comment-extension",
2+
"name": "x-posts-finder",
33
"private": true,
44
"version": "0.0.0",
55
"type": "module",

src/background.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
4646

4747
async function analyzeTweet(tweetText: string, settings: Settings): Promise<boolean> {
4848
try {
49-
const prompt = `I want to comment on tweets about: "${settings.preferences}"
49+
const prompt = `I want to bookmark posts about: "${settings.preferences}"
5050
5151
Tweet: "${tweetText}"
5252
53-
Should I comment? Answer only YES or NO.`
53+
Should I bookmark this post? Answer only YES or NO.`
5454

5555
const headers: Record<string, string> = {
5656
'Content-Type': 'application/json'

src/content.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ async function startProcessing() {
2828

2929
const processedTweets = new Set<string>()
3030

31-
while (isProcessing && processedCount < settings.postLimit) {
31+
while (isProcessing && bookmarkedCount < settings.bookmarksLimit) {
3232
// Find all tweet articles on the page
3333
const tweets = document.querySelectorAll('[data-testid="tweet"]')
3434
let newTweetsFound = false
3535

3636
for (const tweet of tweets) {
37-
if (!isProcessing || processedCount >= settings.postLimit) break
37+
if (!isProcessing || bookmarkedCount >= settings.bookmarksLimit) break
3838

3939
// Create a unique identifier for this tweet
4040
const tweetId = getTweetId(tweet as HTMLElement)

src/features/configuration/ConfigurationForm.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ interface ConfigurationFormProps {
77
}
88

99
export function ConfigurationForm({ settings, onUpdate, onPersist }: ConfigurationFormProps) {
10-
const handlePostLimitChange = (value: string) => {
10+
const handleBookmarksLimitChange = (value: string) => {
1111
// Allow empty string or numeric values only
1212
const numericValue = value.replace(/[^0-9]/g, '')
1313
const parsedValue = parseInt(numericValue, 10)
14-
onUpdate({ postLimit: Number.isNaN(parsedValue) ? 0 : parsedValue })
14+
onUpdate({ bookmarksLimit: Number.isNaN(parsedValue) ? 0 : parsedValue })
1515
}
1616

1717
return (
@@ -59,14 +59,14 @@ export function ConfigurationForm({ settings, onUpdate, onPersist }: Configurati
5959
</div>
6060

6161
<div className="form-group form-group-compact">
62-
<label className="form-label">Post Limit</label>
62+
<label className="form-label">Bookmarks Limit</label>
6363
<input
6464
type="text"
65-
value={settings.postLimit}
66-
onChange={(event) => handlePostLimitChange(event.target.value)}
65+
value={settings.bookmarksLimit}
66+
onChange={(event) => handleBookmarksLimitChange(event.target.value)}
6767
onBlur={onPersist}
6868
className="form-input"
69-
placeholder="Enter number of posts (1-10000)"
69+
placeholder="Enter number of bookmarks (1-10000)"
7070
/>
7171
</div>
7272
</div>
@@ -78,7 +78,7 @@ export function ConfigurationForm({ settings, onUpdate, onPersist }: Configurati
7878
onChange={(event) => onUpdate({ preferences: event.target.value })}
7979
onBlur={onPersist}
8080
className="form-textarea"
81-
placeholder="I want to comment on posts about technology, startups, or programming that seem controversial or have interesting discussions..."
81+
placeholder="I want to bookmark posts about technology, startups, or programming that seem controversial or have interesting discussions..."
8282
/>
8383
<div className="character-counter">
8484
{settings.preferences.length}/500 characters

src/features/popup/Popup.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export function Popup() {
4141
}, [resetProcessing])
4242

4343
const { progressPercentage, bookmarkRate } = useMemo(() => {
44-
const progress = settings.postLimit > 0
45-
? (processedCount / settings.postLimit) * 100
44+
const progress = settings.bookmarksLimit > 0
45+
? (bookmarkedCount / settings.bookmarksLimit) * 100
4646
: 0
4747

4848
const rate = processedCount > 0
@@ -53,7 +53,7 @@ export function Popup() {
5353
progressPercentage: progress,
5454
bookmarkRate: rate
5555
}
56-
}, [bookmarkedCount, processedCount, settings.postLimit])
56+
}, [bookmarkedCount, processedCount, settings.bookmarksLimit])
5757

5858
const showProcessingState = isProcessing || isCompleted
5959

src/lib/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export const DEFAULT_SETTINGS: Settings = {
55
apiKey: '',
66
modelName: 'gpt-5-nano',
77
preferences: 'Only include posts from solo builders when they share real, specific work on their product.',
8-
postLimit: 100
8+
bookmarksLimit: 100
99
}
1010

1111
export const INITIAL_PROCESSING_STATE: ProcessingState = {

src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export interface Settings {
33
apiKey: string
44
modelName: string
55
preferences: string
6-
postLimit: number
6+
bookmarksLimit: number
77
}
88

99
export interface ProcessingState {

0 commit comments

Comments
 (0)