mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Fix sort
Embarassing mistake, i know
This commit is contained in:
parent
6e898fd704
commit
cec8cbff0a
2 changed files with 45 additions and 40 deletions
64
src/locales/en.po
generated
64
src/locales/en.po
generated
|
@ -118,7 +118,7 @@ msgstr ""
|
||||||
#: src/pages/hashtag.jsx:199
|
#: src/pages/hashtag.jsx:199
|
||||||
#: src/pages/list.jsx:157
|
#: src/pages/list.jsx:157
|
||||||
#: src/pages/public.jsx:114
|
#: src/pages/public.jsx:114
|
||||||
#: src/pages/status.jsx:1207
|
#: src/pages/status.jsx:1212
|
||||||
#: src/pages/trending.jsx:471
|
#: src/pages/trending.jsx:471
|
||||||
msgid "More"
|
msgid "More"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -185,8 +185,8 @@ msgstr ""
|
||||||
#: src/pages/catchup.jsx:71
|
#: src/pages/catchup.jsx:71
|
||||||
#: src/pages/catchup.jsx:1445
|
#: src/pages/catchup.jsx:1445
|
||||||
#: src/pages/catchup.jsx:2056
|
#: src/pages/catchup.jsx:2056
|
||||||
#: src/pages/status.jsx:930
|
#: src/pages/status.jsx:935
|
||||||
#: src/pages/status.jsx:1552
|
#: src/pages/status.jsx:1557
|
||||||
msgid "Replies"
|
msgid "Replies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ msgstr ""
|
||||||
#: src/pages/notifications.jsx:868
|
#: src/pages/notifications.jsx:868
|
||||||
#: src/pages/notifications.jsx:1082
|
#: src/pages/notifications.jsx:1082
|
||||||
#: src/pages/settings.jsx:76
|
#: src/pages/settings.jsx:76
|
||||||
#: src/pages/status.jsx:1294
|
#: src/pages/status.jsx:1299
|
||||||
msgid "Close"
|
msgid "Close"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ msgstr ""
|
||||||
#: src/pages/list.jsx:293
|
#: src/pages/list.jsx:293
|
||||||
#: src/pages/notifications.jsx:848
|
#: src/pages/notifications.jsx:848
|
||||||
#: src/pages/search.jsx:529
|
#: src/pages/search.jsx:529
|
||||||
#: src/pages/status.jsx:1327
|
#: src/pages/status.jsx:1332
|
||||||
msgid "Show more…"
|
msgid "Show more…"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -1366,7 +1366,7 @@ msgstr ""
|
||||||
|
|
||||||
#: src/components/nav-menu.jsx:363
|
#: src/components/nav-menu.jsx:363
|
||||||
#: src/pages/login.jsx:189
|
#: src/pages/login.jsx:189
|
||||||
#: src/pages/status.jsx:830
|
#: src/pages/status.jsx:835
|
||||||
#: src/pages/welcome.jsx:64
|
#: src/pages/welcome.jsx:64
|
||||||
msgid "Log in"
|
msgid "Log in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -1556,8 +1556,8 @@ msgstr ""
|
||||||
|
|
||||||
#: src/components/poll.jsx:205
|
#: src/components/poll.jsx:205
|
||||||
#: src/components/poll.jsx:207
|
#: src/components/poll.jsx:207
|
||||||
#: src/pages/status.jsx:1196
|
#: src/pages/status.jsx:1201
|
||||||
#: src/pages/status.jsx:1219
|
#: src/pages/status.jsx:1224
|
||||||
msgid "Refresh"
|
msgid "Refresh"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -2325,8 +2325,8 @@ msgstr ""
|
||||||
#: src/components/timeline.jsx:554
|
#: src/components/timeline.jsx:554
|
||||||
#: src/pages/home.jsx:213
|
#: src/pages/home.jsx:213
|
||||||
#: src/pages/notifications.jsx:824
|
#: src/pages/notifications.jsx:824
|
||||||
#: src/pages/status.jsx:983
|
#: src/pages/status.jsx:988
|
||||||
#: src/pages/status.jsx:1356
|
#: src/pages/status.jsx:1361
|
||||||
msgid "Try again"
|
msgid "Try again"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -3574,85 +3574,85 @@ msgid "NOTE: Push notifications only work for <0>one account</0>."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#. js-lingui-explicit-id
|
#. js-lingui-explicit-id
|
||||||
#: src/pages/status.jsx:592
|
#: src/pages/status.jsx:597
|
||||||
#: src/pages/status.jsx:1126
|
#: src/pages/status.jsx:1131
|
||||||
msgid "post.title"
|
msgid "post.title"
|
||||||
msgstr "Post"
|
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."
|
msgid "You're not logged in. Interactions (reply, boost, etc) are not possible."
|
||||||
msgstr ""
|
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."
|
msgid "This post is from another instance (<0>{instance}</0>). Interactions (reply, boost, etc) are not possible."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:865
|
#: src/pages/status.jsx:870
|
||||||
msgid "Error: {e}"
|
msgid "Error: {e}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:872
|
#: src/pages/status.jsx:877
|
||||||
msgid "Switch to my instance to enable interactions"
|
msgid "Switch to my instance to enable interactions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:974
|
#: src/pages/status.jsx:979
|
||||||
msgid "Unable to load replies."
|
msgid "Unable to load replies."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1086
|
#: src/pages/status.jsx:1091
|
||||||
msgid "Back"
|
msgid "Back"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1117
|
#: src/pages/status.jsx:1122
|
||||||
msgid "Go to main post"
|
msgid "Go to main post"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1140
|
#: src/pages/status.jsx:1145
|
||||||
msgid "{0} posts above ‒ Go to top"
|
msgid "{0} posts above ‒ Go to top"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1183
|
#: src/pages/status.jsx:1188
|
||||||
#: src/pages/status.jsx:1246
|
#: src/pages/status.jsx:1251
|
||||||
msgid "Switch to Side Peek view"
|
msgid "Switch to Side Peek view"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1247
|
#: src/pages/status.jsx:1252
|
||||||
msgid "Switch to Full view"
|
msgid "Switch to Full view"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1265
|
#: src/pages/status.jsx:1270
|
||||||
msgid "Show all sensitive content"
|
msgid "Show all sensitive content"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1270
|
#: src/pages/status.jsx:1275
|
||||||
msgid "Experimental"
|
msgid "Experimental"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1279
|
#: src/pages/status.jsx:1284
|
||||||
msgid "Unable to switch"
|
msgid "Unable to switch"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1286
|
#: src/pages/status.jsx:1291
|
||||||
msgid "Switch to post's instance ({0})"
|
msgid "Switch to post's instance ({0})"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1289
|
#: src/pages/status.jsx:1294
|
||||||
msgid "Switch to post's instance"
|
msgid "Switch to post's instance"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1347
|
#: src/pages/status.jsx:1352
|
||||||
msgid "Unable to load post"
|
msgid "Unable to load post"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1482
|
#: src/pages/status.jsx:1487
|
||||||
msgid "{0, plural, one {# reply} other {<0>{1}</0> replies}}"
|
msgid "{0, plural, one {# reply} other {<0>{1}</0> replies}}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1500
|
#: src/pages/status.jsx:1505
|
||||||
msgid "{totalComments, plural, one {# comment} other {<0>{0}</0> comments}}"
|
msgid "{totalComments, plural, one {# comment} other {<0>{0}</0> comments}}"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/pages/status.jsx:1522
|
#: src/pages/status.jsx:1527
|
||||||
msgid "View post with its replies"
|
msgid "View post with its replies"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
|
@ -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 }) {
|
function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
const mediaParam = searchParams.get('media');
|
const mediaParam = searchParams.get('media');
|
||||||
|
@ -321,9 +326,8 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
const context = await contextFetch;
|
const context = await contextFetch;
|
||||||
const { ancestors, descendants } = context;
|
const { ancestors, descendants } = context;
|
||||||
|
|
||||||
// Sort oldest first
|
ancestors.sort(createdAtSort);
|
||||||
ancestors.sort((a, b) => a.createdAt - b.createdAt);
|
descendants.sort(createdAtSort);
|
||||||
// descendants.sort((a, b) => a.createdAt - b.createdAt);
|
|
||||||
|
|
||||||
totalDescendants.current = descendants?.length || 0;
|
totalDescendants.current = descendants?.length || 0;
|
||||||
|
|
||||||
|
@ -388,13 +392,14 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
nestedDescendants.sort((a, b) => {
|
|
||||||
// sort hero author to top
|
// sort hero author to top
|
||||||
|
nestedDescendants.sort((a, b) => {
|
||||||
const heroAccountID = heroStatus.account.id;
|
const heroAccountID = heroStatus.account.id;
|
||||||
if (a.account.id === heroAccountID) return -1;
|
if (a.account.id === heroAccountID && b.account.id !== heroAccountID)
|
||||||
if (b.account.id === heroAccountID) return 1;
|
return -1;
|
||||||
// sort by createdAt (oldest first)
|
if (b.account.id === heroAccountID && a.account.id !== heroAccountID)
|
||||||
return a.createdAt - b.createdAt;
|
return 1;
|
||||||
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log({ ancestors, descendants, nestedDescendants });
|
console.log({ ancestors, descendants, nestedDescendants });
|
||||||
|
|
Loading…
Reference in a new issue