diff --git a/dist/index.css b/dist/index.css index 605d6214..cb8720b6 100644 --- a/dist/index.css +++ b/dist/index.css @@ -368,11 +368,9 @@ body[showing-chat] #chat-page-wrapper { width: 100%; max-width: unset; flex: 1; + border-top: 1px solid var(--border); } @media (max-width: 700px) { - #message-page #composer { - border-top: 1px solid var(--border); - } #message-page #composer div { width: 100%; max-width: unset; diff --git a/dist/index.js b/dist/index.js index 64f7db27..2bc56811 100644 --- a/dist/index.js +++ b/dist/index.js @@ -483,19 +483,22 @@ get messages() { const messageIds = this.storageModel.list(this.messageDirPath); if (!Array.isArray(messageIds)) return []; - let messages = []; + const messages = []; for (const messageId of messageIds) { const messagePath = this.getMessagePath(messageId); const message = this.storageModel.restoreStringifiable(messagePath); if (checkIsValidObject(message) == false) continue; messages.push(message); } - return messages; + const sorted = messages.sort( + (a, b) => a.dateSent.localeCompare(b.dateSent) + ); + return sorted; } get objects() { const objectIds = this.storageModel.list(this.objectDirPath); if (!Array.isArray(objectIds)) return []; - let objects = []; + const objects = []; for (const objectId of objectIds) { const objectPathComponents = this.getObjectPath(objectId); const object = this.storageModel.restoreStringifiable(objectPathComponents); diff --git a/src/Model/chatModel.ts b/src/Model/chatModel.ts index 7ce83b95..e4250b87 100644 --- a/src/Model/chatModel.ts +++ b/src/Model/chatModel.ts @@ -133,7 +133,7 @@ export class ChatModel { const messageIds: string[] = this.storageModel.list(this.messageDirPath); if (!Array.isArray(messageIds)) return []; - let messages: ChatMessage[] = []; + const messages: ChatMessage[] = []; for (const messageId of messageIds) { const messagePath: string[] = this.getMessagePath(messageId); const message: any = this.storageModel.restoreStringifiable(messagePath); @@ -141,14 +141,18 @@ export class ChatModel { messages.push(message); } - return messages; + + const sorted = messages.sort((a, b) => + a.dateSent.localeCompare(b.dateSent) + ); + return sorted; } get objects(): ChatObject[] { const objectIds: string[] = this.storageModel.list(this.objectDirPath); if (!Array.isArray(objectIds)) return []; - let objects: ChatObject[] = []; + const objects: ChatObject[] = []; for (const objectId of objectIds) { const objectPathComponents: string[] = this.getObjectPath(objectId); const object: any = diff --git a/src/View/ChatPages/messagePage.css b/src/View/ChatPages/messagePage.css index b6cc7b9f..096dd65d 100644 --- a/src/View/ChatPages/messagePage.css +++ b/src/View/ChatPages/messagePage.css @@ -25,12 +25,11 @@ max-width: unset; flex: 1; + + border-top: 1px solid var(--border); } @media (max-width: 700px) { - #message-page #composer { - border-top: 1px solid var(--border); - } #message-page #composer div { width: 100%;