Skip to content

Commit 4721472

Browse files
committed
refactor: builders only accept post id
1 parent 524cb16 commit 4721472

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

app/components/note/Note.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { useMemo } from "react";
33

44
import { LANGUAGE_ID_TO_LABEL } from "../../feature/search/language";
55
import {
6-
birdWatchLinkFromNote,
7-
postLinkFromNote,
6+
birdWatchLinkFromPostId,
7+
postLinkFromPostId,
88
} from "../../feature/twitter/link-builder";
99
import type { SearchedNote } from "../../generated/api/schemas";
1010
import { isNonEmptyString } from "../../utils/string";
@@ -66,7 +66,7 @@ export const Note = ({ note }: NoteProps) => {
6666
<Button
6767
color="pink"
6868
component="a"
69-
href={postLinkFromNote(note)}
69+
href={postLinkFromPostId(note.postId)}
7070
size="xs"
7171
target="_blank"
7272
variant="light"
@@ -76,7 +76,7 @@ export const Note = ({ note }: NoteProps) => {
7676
<Button
7777
color="pink"
7878
component="a"
79-
href={birdWatchLinkFromNote(note)}
79+
href={birdWatchLinkFromPostId(note.postId)}
8080
size="xs"
8181
target="_blank"
8282
variant="light"
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import type { Note } from "../../generated/api/schemas";
2-
3-
export const birdWatchLinkFromNote = (note: Note): string => {
4-
return `https://x.com/i/birdwatch/t/${note.postId}`;
1+
export const birdWatchLinkFromPostId = (postId: string): string => {
2+
return `https://x.com/i/birdwatch/t/${postId}`;
53
};
64

7-
export const postLinkFromNote = (note: Note): string => {
5+
export const postLinkFromPostId = (postId: string): string => {
86
// X redirects to correct post url regardless of userId, so just specify `i`
9-
return `https://x.com/i/status/${note.postId}`;
7+
return `https://x.com/i/status/${postId}`;
108
};

0 commit comments

Comments
 (0)