improve ui
This commit is contained in:
Vendored
+14
@@ -92,11 +92,13 @@ main {
|
|||||||
/* src/colors.css */
|
/* src/colors.css */
|
||||||
[color]:not([color=standard]) {
|
[color]:not([color=standard]) {
|
||||||
--primary: hsl(var(--hue), 100%, var(--accent-luma));
|
--primary: hsl(var(--hue), 100%, var(--accent-luma));
|
||||||
|
--text-on-color: hsl(0, 0%, var(--accent-text-luma));
|
||||||
--link: hsl(var(--hue), 100%, var(--accent-luma));
|
--link: hsl(var(--hue), 100%, var(--accent-luma));
|
||||||
}
|
}
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
[color]:not([color=standard]) {
|
[color]:not([color=standard]) {
|
||||||
--accent-luma: var(--accent-luma-dark);
|
--accent-luma: var(--accent-luma-dark);
|
||||||
|
--accent-text-luma: var(--accent-text-luma-dark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[color]:not([color=standard]).tile {
|
[color]:not([color=standard]).tile {
|
||||||
@@ -136,31 +138,43 @@ main {
|
|||||||
--hue: 20;
|
--hue: 20;
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
[color=yellow] {
|
[color=yellow] {
|
||||||
--hue: 50;
|
--hue: 50;
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
[color=mint] {
|
[color=mint] {
|
||||||
--hue: 150;
|
--hue: 150;
|
||||||
--accent-luma: 40%;
|
--accent-luma: 40%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
[color=lightblue] {
|
[color=lightblue] {
|
||||||
--hue: 180;
|
--hue: 180;
|
||||||
--accent-luma: 40%;
|
--accent-luma: 40%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
[color=blue] {
|
[color=blue] {
|
||||||
--hue: 220;
|
--hue: 220;
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
[color=purple] {
|
[color=purple] {
|
||||||
--hue: 280;
|
--hue: 280;
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* src/View/chatPage.css */
|
/* src/View/chatPage.css */
|
||||||
|
|||||||
Vendored
+12
-4
@@ -239,6 +239,9 @@
|
|||||||
function parse(string) {
|
function parse(string) {
|
||||||
return JSON.parse(string);
|
return JSON.parse(string);
|
||||||
}
|
}
|
||||||
|
function localeCompare(a, b) {
|
||||||
|
return a.localeCompare(b);
|
||||||
|
}
|
||||||
|
|
||||||
// src/Model/Utility/typeSafety.ts
|
// src/Model/Utility/typeSafety.ts
|
||||||
var DATA_VERSION = "v2";
|
var DATA_VERSION = "v2";
|
||||||
@@ -539,7 +542,7 @@
|
|||||||
for (const chatModel of this.chatModels) {
|
for (const chatModel of this.chatModels) {
|
||||||
allChannels.push(chatModel.info.primaryChannel);
|
allChannels.push(chatModel.info.primaryChannel);
|
||||||
}
|
}
|
||||||
this.sortedPrimaryChannels = allChannels.sort((a, b) => a.localeCompare(b));
|
this.sortedPrimaryChannels = allChannels.sort(localeCompare);
|
||||||
};
|
};
|
||||||
// restore
|
// restore
|
||||||
loadChats = () => {
|
loadChats = () => {
|
||||||
@@ -598,6 +601,7 @@
|
|||||||
this.secondaryChannels.add(this.newSecondaryChannelInput.value);
|
this.secondaryChannels.add(this.newSecondaryChannelInput.value);
|
||||||
this.newSecondaryChannelInput.value = "";
|
this.newSecondaryChannelInput.value = "";
|
||||||
this.storeSecondaryChannels();
|
this.storeSecondaryChannels();
|
||||||
|
this.restoreSecondaryChannels();
|
||||||
};
|
};
|
||||||
removeSecondaryChannel = (secondaryChannel) => {
|
removeSecondaryChannel = (secondaryChannel) => {
|
||||||
this.secondaryChannels.remove(secondaryChannel);
|
this.secondaryChannels.remove(secondaryChannel);
|
||||||
@@ -623,6 +627,12 @@
|
|||||||
this.storageModel.store(path, newPage);
|
this.storageModel.store(path, newPage);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
restoreSecondaryChannels = () => {
|
||||||
|
this.secondaryChannels.clear();
|
||||||
|
for (const secondaryChannel of this.chatModel.info.secondaryChannels.sort(localeCompare)) {
|
||||||
|
this.secondaryChannels.add(secondaryChannel);
|
||||||
|
}
|
||||||
|
};
|
||||||
// init
|
// init
|
||||||
constructor(chatListViewModel2, chatModel) {
|
constructor(chatListViewModel2, chatModel) {
|
||||||
this.chatModel = chatModel;
|
this.chatModel = chatModel;
|
||||||
@@ -630,10 +640,8 @@
|
|||||||
this.chatListViewModel = chatListViewModel2;
|
this.chatListViewModel = chatListViewModel2;
|
||||||
this.primaryChannel.value = chatModel.info.primaryChannel;
|
this.primaryChannel.value = chatModel.info.primaryChannel;
|
||||||
this.primaryChannelInput.value = chatModel.info.primaryChannel;
|
this.primaryChannelInput.value = chatModel.info.primaryChannel;
|
||||||
for (const secondaryChannel of chatModel.info.secondaryChannels) {
|
|
||||||
this.secondaryChannels.add(secondaryChannel);
|
|
||||||
}
|
|
||||||
this.color.value = chatModel.color;
|
this.color.value = chatModel.color;
|
||||||
|
this.restoreSecondaryChannels();
|
||||||
this.restorePageSelection();
|
this.restorePageSelection();
|
||||||
this.updateIndex();
|
this.updateIndex();
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -215,7 +215,7 @@ button.ghost:active {
|
|||||||
/* danger button */
|
/* danger button */
|
||||||
button.danger {
|
button.danger {
|
||||||
background: var(--danger);
|
background: var(--danger);
|
||||||
color: var(--text-on-color);
|
color: white;
|
||||||
}
|
}
|
||||||
@media (hover: hover) {
|
@media (hover: hover) {
|
||||||
button.danger:hover {
|
button.danger:hover {
|
||||||
|
|||||||
@@ -11,3 +11,8 @@ export function stringify(data: any): string {
|
|||||||
export function parse(string: string): any {
|
export function parse(string: string): any {
|
||||||
return JSON.parse(string);
|
return JSON.parse(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sort
|
||||||
|
export function localeCompare(a: string, b: string): number {
|
||||||
|
return a.localeCompare(b);
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import StorageModel, { storageKeys } from "./storageModel";
|
import StorageModel, { storageKeys } from "./storageModel";
|
||||||
|
|
||||||
import { ChatModel } from "./chatModel";
|
import { ChatModel } from "./chatModel";
|
||||||
|
import { localeCompare } from "./Utility/utility";
|
||||||
import { v4 } from "uuid";
|
import { v4 } from "uuid";
|
||||||
|
|
||||||
export default class ChatListModel {
|
export default class ChatListModel {
|
||||||
@@ -40,7 +41,7 @@ export default class ChatListModel {
|
|||||||
allChannels.push(chatModel.info.primaryChannel);
|
allChannels.push(chatModel.info.primaryChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sortedPrimaryChannels = allChannels.sort((a, b) => a.localeCompare(b));
|
this.sortedPrimaryChannels = allChannels.sort(localeCompare);
|
||||||
};
|
};
|
||||||
|
|
||||||
// restore
|
// restore
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import StorageModel, { storageKeys } from "../Model/storageModel";
|
|||||||
import ChatListViewModel from "./chatListViewModel";
|
import ChatListViewModel from "./chatListViewModel";
|
||||||
import { ChatModel } from "../Model/chatModel";
|
import { ChatModel } from "../Model/chatModel";
|
||||||
import { Color } from "./colors";
|
import { Color } from "./colors";
|
||||||
|
import { localeCompare } from "../Model/Utility/utility";
|
||||||
|
|
||||||
export default class ChatViewModel {
|
export default class ChatViewModel {
|
||||||
chatModel: ChatModel;
|
chatModel: ChatModel;
|
||||||
@@ -59,6 +60,7 @@ export default class ChatViewModel {
|
|||||||
this.secondaryChannels.add(this.newSecondaryChannelInput.value);
|
this.secondaryChannels.add(this.newSecondaryChannelInput.value);
|
||||||
this.newSecondaryChannelInput.value = "";
|
this.newSecondaryChannelInput.value = "";
|
||||||
this.storeSecondaryChannels();
|
this.storeSecondaryChannels();
|
||||||
|
this.restoreSecondaryChannels();
|
||||||
};
|
};
|
||||||
|
|
||||||
removeSecondaryChannel = (secondaryChannel: string): void => {
|
removeSecondaryChannel = (secondaryChannel: string): void => {
|
||||||
@@ -70,7 +72,7 @@ export default class ChatViewModel {
|
|||||||
this.chatModel.setSecondaryChannels([
|
this.chatModel.setSecondaryChannels([
|
||||||
...this.secondaryChannels.value.values(),
|
...this.secondaryChannels.value.values(),
|
||||||
]);
|
]);
|
||||||
}
|
};
|
||||||
|
|
||||||
setColor = (newColor: Color): void => {
|
setColor = (newColor: Color): void => {
|
||||||
this.color.value = newColor;
|
this.color.value = newColor;
|
||||||
@@ -90,6 +92,13 @@ export default class ChatViewModel {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
restoreSecondaryChannels = (): void => {
|
||||||
|
this.secondaryChannels.clear();
|
||||||
|
for (const secondaryChannel of this.chatModel.info.secondaryChannels.sort(localeCompare)) {
|
||||||
|
this.secondaryChannels.add(secondaryChannel);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// init
|
// init
|
||||||
constructor(chatListViewModel: ChatListViewModel, chatModel: ChatModel) {
|
constructor(chatListViewModel: ChatListViewModel, chatModel: ChatModel) {
|
||||||
this.chatModel = chatModel;
|
this.chatModel = chatModel;
|
||||||
@@ -99,12 +108,9 @@ export default class ChatViewModel {
|
|||||||
this.primaryChannel.value = chatModel.info.primaryChannel;
|
this.primaryChannel.value = chatModel.info.primaryChannel;
|
||||||
this.primaryChannelInput.value = chatModel.info.primaryChannel;
|
this.primaryChannelInput.value = chatModel.info.primaryChannel;
|
||||||
|
|
||||||
for (const secondaryChannel of chatModel.info.secondaryChannels) {
|
|
||||||
this.secondaryChannels.add(secondaryChannel);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.color.value = chatModel.color;
|
this.color.value = chatModel.color;
|
||||||
|
|
||||||
|
this.restoreSecondaryChannels();
|
||||||
this.restorePageSelection();
|
this.restorePageSelection();
|
||||||
this.updateIndex();
|
this.updateIndex();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
/* basic */
|
/* basic */
|
||||||
[color]:not([color="standard"]) {
|
[color]:not([color="standard"]) {
|
||||||
--primary: hsl(var(--hue), 100%, var(--accent-luma));
|
--primary: hsl(var(--hue), 100%, var(--accent-luma));
|
||||||
|
--text-on-color: hsl(0, 0%, var(--accent-text-luma));
|
||||||
--link: hsl(var(--hue), 100%, var(--accent-luma));
|
--link: hsl(var(--hue), 100%, var(--accent-luma));
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
@media (prefers-color-scheme: dark) {
|
||||||
[color]:not([color="standard"]) {
|
[color]:not([color="standard"]) {
|
||||||
--accent-luma: var(--accent-luma-dark);
|
--accent-luma: var(--accent-luma-dark);
|
||||||
|
--accent-text-luma: var(--accent-text-luma-dark);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,36 +59,60 @@
|
|||||||
/* definitions */
|
/* definitions */
|
||||||
[color="coral"] {
|
[color="coral"] {
|
||||||
--hue: 20;
|
--hue: 20;
|
||||||
|
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[color="yellow"] {
|
[color="yellow"] {
|
||||||
--hue: 50;
|
--hue: 50;
|
||||||
|
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[color="mint"] {
|
[color="mint"] {
|
||||||
--hue: 150;
|
--hue: 150;
|
||||||
|
|
||||||
--accent-luma: 40%;
|
--accent-luma: 40%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[color="lightblue"] {
|
[color="lightblue"] {
|
||||||
--hue: 180;
|
--hue: 180;
|
||||||
|
|
||||||
--accent-luma: 40%;
|
--accent-luma: 40%;
|
||||||
--accent-luma-dark: 60%;
|
--accent-luma-dark: 60%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 0%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[color="blue"] {
|
[color="blue"] {
|
||||||
--hue: 220;
|
--hue: 220;
|
||||||
|
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
[color="purple"] {
|
[color="purple"] {
|
||||||
--hue: 280;
|
--hue: 280;
|
||||||
|
|
||||||
--accent-luma: 50%;
|
--accent-luma: 50%;
|
||||||
--accent-luma-dark: 70%;
|
--accent-luma-dark: 70%;
|
||||||
|
|
||||||
|
--accent-text-luma: 100%;
|
||||||
|
--accent-text-luma-dark: 100%;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user