summaryrefslogtreecommitdiff
path: root/extension/react-app/src/pages/history.tsx
diff options
context:
space:
mode:
authorNate Sesti <sestinj@gmail.com>2023-08-07 13:29:54 -0700
committerNate Sesti <sestinj@gmail.com>2023-08-07 13:29:54 -0700
commitfd77a4bd6b255260d0f4cad11947b38f4d30030e (patch)
tree320c6901e10f4f20ba741ee82ef3e9c90e84877b /extension/react-app/src/pages/history.tsx
parent145642f1eaf01d5809dabd79e7f64f234124683e (diff)
downloadsncontinue-fd77a4bd6b255260d0f4cad11947b38f4d30030e.tar.gz
sncontinue-fd77a4bd6b255260d0f4cad11947b38f4d30030e.tar.bz2
sncontinue-fd77a4bd6b255260d0f4cad11947b38f4d30030e.zip
feat: :children_crossing: sort history by reverse date
Diffstat (limited to 'extension/react-app/src/pages/history.tsx')
-rw-r--r--extension/react-app/src/pages/history.tsx54
1 files changed, 28 insertions, 26 deletions
diff --git a/extension/react-app/src/pages/history.tsx b/extension/react-app/src/pages/history.tsx
index c3240a66..edf4d39f 100644
--- a/extension/react-app/src/pages/history.tsx
+++ b/extension/react-app/src/pages/history.tsx
@@ -59,32 +59,34 @@ function History() {
</div>
<table className="w-full">
<tbody>
- {sessions.map((session, index) => (
- <Tr key={index}>
- <td>
- <TdDiv
- onClick={() => {
- client?.loadSession(session.session_id);
- navigate("/");
- }}
- >
- <div className="text-lg">{session.title}</div>
- <div className="text-gray-400">
- {new Date(
- parseInt(session.date_created) * 1000
- ).toLocaleString("en-US", {
- weekday: "short",
- year: "numeric",
- month: "long",
- day: "numeric",
- hour: "numeric",
- minute: "numeric",
- })}
- </div>
- </TdDiv>
- </td>
- </Tr>
- ))}
+ {sessions
+ .sort((a, b) => parseInt(b.date_created) - parseInt(a.date_created))
+ .map((session, index) => (
+ <Tr key={index}>
+ <td>
+ <TdDiv
+ onClick={() => {
+ client?.loadSession(session.session_id);
+ navigate("/");
+ }}
+ >
+ <div className="text-lg">{session.title}</div>
+ <div className="text-gray-400">
+ {new Date(
+ parseInt(session.date_created) * 1000
+ ).toLocaleString("en-US", {
+ weekday: "short",
+ year: "numeric",
+ month: "long",
+ day: "numeric",
+ hour: "numeric",
+ minute: "numeric",
+ })}
+ </div>
+ </TdDiv>
+ </td>
+ </Tr>
+ ))}
</tbody>
</table>
<br />