Embarassing mistake, i know
This commit is contained in:
Lim Chee Aun 2024-11-01 18:13:01 +08:00
parent 6e898fd704
commit cec8cbff0a
2 changed files with 45 additions and 40 deletions

64
src/locales/en.po generated
View file

@ -118,7 +118,7 @@ msgstr ""
#: src/pages/hashtag.jsx:199
#: src/pages/list.jsx:157
#: src/pages/public.jsx:114
#: src/pages/status.jsx:1207
#: src/pages/status.jsx:1212
#: src/pages/trending.jsx:471
msgid "More"
msgstr ""
@ -185,8 +185,8 @@ msgstr ""
#: src/pages/catchup.jsx:71
#: src/pages/catchup.jsx:1445
#: src/pages/catchup.jsx:2056
#: src/pages/status.jsx:930
#: src/pages/status.jsx:1552
#: src/pages/status.jsx:935
#: src/pages/status.jsx:1557
msgid "Replies"
msgstr ""
@ -427,7 +427,7 @@ msgstr ""
#: src/pages/notifications.jsx:868
#: src/pages/notifications.jsx:1082
#: src/pages/settings.jsx:76
#: src/pages/status.jsx:1294
#: src/pages/status.jsx:1299
msgid "Close"
msgstr ""
@ -967,7 +967,7 @@ msgstr ""
#: src/pages/list.jsx:293
#: src/pages/notifications.jsx:848
#: src/pages/search.jsx:529
#: src/pages/status.jsx:1327
#: src/pages/status.jsx:1332
msgid "Show more…"
msgstr ""
@ -1366,7 +1366,7 @@ msgstr ""
#: src/components/nav-menu.jsx:363
#: src/pages/login.jsx:189
#: src/pages/status.jsx:830
#: src/pages/status.jsx:835
#: src/pages/welcome.jsx:64
msgid "Log in"
msgstr ""
@ -1556,8 +1556,8 @@ msgstr ""
#: src/components/poll.jsx:205
#: src/components/poll.jsx:207
#: src/pages/status.jsx:1196
#: src/pages/status.jsx:1219
#: src/pages/status.jsx:1201
#: src/pages/status.jsx:1224
msgid "Refresh"
msgstr ""
@ -2325,8 +2325,8 @@ msgstr ""
#: src/components/timeline.jsx:554
#: src/pages/home.jsx:213
#: src/pages/notifications.jsx:824
#: src/pages/status.jsx:983
#: src/pages/status.jsx:1356
#: src/pages/status.jsx:988
#: src/pages/status.jsx:1361
msgid "Try again"
msgstr ""
@ -3574,85 +3574,85 @@ msgid "NOTE: Push notifications only work for <0>one account</0>."
msgstr ""
#. js-lingui-explicit-id
#: src/pages/status.jsx:592
#: src/pages/status.jsx:1126
#: src/pages/status.jsx:597
#: src/pages/status.jsx:1131
msgid "post.title"
msgstr "Post"
#: src/pages/status.jsx:817
#: src/pages/status.jsx:822
msgid "You're not logged in. Interactions (reply, boost, etc) are not possible."
msgstr ""
#: src/pages/status.jsx:837
#: src/pages/status.jsx:842
msgid "This post is from another instance (<0>{instance}</0>). Interactions (reply, boost, etc) are not possible."
msgstr ""
#: src/pages/status.jsx:865
#: src/pages/status.jsx:870
msgid "Error: {e}"
msgstr ""
#: src/pages/status.jsx:872
#: src/pages/status.jsx:877
msgid "Switch to my instance to enable interactions"
msgstr ""
#: src/pages/status.jsx:974
#: src/pages/status.jsx:979
msgid "Unable to load replies."
msgstr ""
#: src/pages/status.jsx:1086
#: src/pages/status.jsx:1091
msgid "Back"
msgstr ""
#: src/pages/status.jsx:1117
#: src/pages/status.jsx:1122
msgid "Go to main post"
msgstr ""
#: src/pages/status.jsx:1140
#: src/pages/status.jsx:1145
msgid "{0} posts above Go to top"
msgstr ""
#: src/pages/status.jsx:1183
#: src/pages/status.jsx:1246
#: src/pages/status.jsx:1188
#: src/pages/status.jsx:1251
msgid "Switch to Side Peek view"
msgstr ""
#: src/pages/status.jsx:1247
#: src/pages/status.jsx:1252
msgid "Switch to Full view"
msgstr ""
#: src/pages/status.jsx:1265
#: src/pages/status.jsx:1270
msgid "Show all sensitive content"
msgstr ""
#: src/pages/status.jsx:1270
#: src/pages/status.jsx:1275
msgid "Experimental"
msgstr ""
#: src/pages/status.jsx:1279
#: src/pages/status.jsx:1284
msgid "Unable to switch"
msgstr ""
#: src/pages/status.jsx:1286
#: src/pages/status.jsx:1291
msgid "Switch to post's instance ({0})"
msgstr ""
#: src/pages/status.jsx:1289
#: src/pages/status.jsx:1294
msgid "Switch to post's instance"
msgstr ""
#: src/pages/status.jsx:1347
#: src/pages/status.jsx:1352
msgid "Unable to load post"
msgstr ""
#: src/pages/status.jsx:1482
#: src/pages/status.jsx:1487
msgid "{0, plural, one {# reply} other {<0>{1}</0> replies}}"
msgstr ""
#: src/pages/status.jsx:1500
#: src/pages/status.jsx:1505
msgid "{totalComments, plural, one {# comment} other {<0>{0}</0> comments}}"
msgstr ""
#: src/pages/status.jsx:1522
#: src/pages/status.jsx:1527
msgid "View post with its replies"
msgstr ""

View file

@ -208,6 +208,11 @@ function StatusParent(props) {
);
}
// oldest first
function createdAtSort(a, b) {
return new Date(b.created_at) - new Date(a.created_at);
}
function StatusThread({ id, closeLink = '/', instance: propInstance }) {
const [searchParams, setSearchParams] = useSearchParams();
const mediaParam = searchParams.get('media');
@ -321,9 +326,8 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
const context = await contextFetch;
const { ancestors, descendants } = context;
// Sort oldest first
ancestors.sort((a, b) => a.createdAt - b.createdAt);
// descendants.sort((a, b) => a.createdAt - b.createdAt);
ancestors.sort(createdAtSort);
descendants.sort(createdAtSort);
totalDescendants.current = descendants?.length || 0;
@ -388,13 +392,14 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
}
});
// sort hero author to top
nestedDescendants.sort((a, b) => {
// sort hero author to top
const heroAccountID = heroStatus.account.id;
if (a.account.id === heroAccountID) return -1;
if (b.account.id === heroAccountID) return 1;
// sort by createdAt (oldest first)
return a.createdAt - b.createdAt;
if (a.account.id === heroAccountID && b.account.id !== heroAccountID)
return -1;
if (b.account.id === heroAccountID && a.account.id !== heroAccountID)
return 1;
return 0;
});
console.log({ ancestors, descendants, nestedDescendants });