mirror of
https://github.com/Steffo99/todocolors.git
synced 2025-01-06 22:09:47 +00:00
Compare commits
No commits in common. "998b0000895f3518bf95c593247326deb5bc481b" and "74b3336ea1f6f07f99a53ec248b1b3bb71c67b7f" have entirely different histories.
998b000089
...
74b3336ea1
7 changed files with 36 additions and 52 deletions
|
@ -6,7 +6,7 @@
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#0d193b",
|
"theme_color": "#0d193b",
|
||||||
"background_color": "#0c193b",
|
"background_color": "#0c193b",
|
||||||
"description": "Multiplayer todo app",
|
"description": "Self-hostable multiplayer todo app",
|
||||||
"categories": ["productivity"],
|
"categories": ["productivity"],
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,15 +4,9 @@ import {ICON_DEFAULT, ICON_GLYPH_RE} from "@/app/[lang]/board/[board]/(page)/(ed
|
||||||
import {IMPORTANCE_GLYPH_RE} from "@/app/[lang]/board/[board]/(page)/(edit)/taskImportance"
|
import {IMPORTANCE_GLYPH_RE} from "@/app/[lang]/board/[board]/(page)/(edit)/taskImportance"
|
||||||
import {default as dateParser} from "any-date-parser"
|
import {default as dateParser} from "any-date-parser"
|
||||||
|
|
||||||
type Attempt = {
|
// ahhh i love typescript shenanigans
|
||||||
year?: number,
|
// @ts-ignore
|
||||||
month?: number,
|
const DATE_FROM_STRING = dateParser.fromString;
|
||||||
day?: number,
|
|
||||||
hour?: number,
|
|
||||||
minute?: number,
|
|
||||||
second?: number,
|
|
||||||
millisecond?: number,
|
|
||||||
}
|
|
||||||
|
|
||||||
const VALUE_TO_TASK_IMPORTANCE = {
|
const VALUE_TO_TASK_IMPORTANCE = {
|
||||||
"1": TaskImportance.Highest,
|
"1": TaskImportance.Highest,
|
||||||
|
@ -29,22 +23,9 @@ export function convertSTT(text: string, lang: string): Task {
|
||||||
|
|
||||||
const importance: TaskImportance = VALUE_TO_TASK_IMPORTANCE[importanceMatch?.[1]?.trim() as "1"|"2"|"3"|"4"|"5" ?? "3"]
|
const importance: TaskImportance = VALUE_TO_TASK_IMPORTANCE[importanceMatch?.[1]?.trim() as "1"|"2"|"3"|"4"|"5" ?? "3"]
|
||||||
const icon: string = iconMatch?.[1]?.trim() ?? ICON_DEFAULT
|
const icon: string = iconMatch?.[1]?.trim() ?? ICON_DEFAULT
|
||||||
|
|
||||||
const now = new Date()
|
|
||||||
const deadlineGroup: string | undefined = deadlineMatch?.[1]?.trim()
|
const deadlineGroup: string | undefined = deadlineMatch?.[1]?.trim()
|
||||||
const deadlineAttempt: Attempt | undefined = deadlineGroup === undefined ? undefined : dateParser.attempt(deadlineGroup, lang) ?? undefined
|
const deadlineDate: Date | undefined = deadlineGroup === undefined ? undefined : DATE_FROM_STRING(deadlineGroup, lang) ?? undefined
|
||||||
const deadlineDate: Date | undefined = deadlineAttempt === undefined ? undefined : new Date(
|
|
||||||
deadlineAttempt.year ?? now.getFullYear(),
|
|
||||||
(deadlineAttempt.month ?? (now.getMonth() + 1)) - 1,
|
|
||||||
deadlineAttempt.day ?? now.getDate(),
|
|
||||||
deadlineAttempt.hour ?? now.getHours(),
|
|
||||||
deadlineAttempt.minute ?? now.getMinutes(),
|
|
||||||
deadlineAttempt.second ?? now.getSeconds(),
|
|
||||||
deadlineAttempt.millisecond ?? now.getMilliseconds(),
|
|
||||||
)
|
|
||||||
const deadline: number | null = (deadlineDate?.getTime?.()) ?? null
|
const deadline: number | null = (deadlineDate?.getTime?.()) ?? null
|
||||||
|
|
||||||
console.debug("[convertSTT]", "\ngroup:", deadlineGroup, "\ndate:", deadlineDate, "\ntimestamp:", deadline)
|
|
||||||
|
|
||||||
// TODO: Splice so the regexes aren't executed twice
|
// TODO: Splice so the regexes aren't executed twice
|
||||||
text = text.replace(IMPORTANCE_GLYPH_RE, "")
|
text = text.replace(IMPORTANCE_GLYPH_RE, "")
|
||||||
|
|
|
@ -16,11 +16,11 @@ type TaskIconProps = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const STATUS_TO_PREFIX: {[t in TaskSimplifiedStatus]: IconPack} = {
|
const STATUS_TO_PREFIX: {[t in TaskSimplifiedStatus]: IconPack} = {
|
||||||
[TaskSimplifiedStatus.Unfinished]: fas,
|
[TaskSimplifiedStatus.Unfinished]: fal,
|
||||||
[TaskSimplifiedStatus.InProgress]: fas,
|
[TaskSimplifiedStatus.InProgress]: far,
|
||||||
[TaskSimplifiedStatus.Complete]: fal,
|
[TaskSimplifiedStatus.Complete]: fas,
|
||||||
[TaskSimplifiedStatus.Journaled]: far,
|
[TaskSimplifiedStatus.Journaled]: fas,
|
||||||
[TaskSimplifiedStatus.NonExistent]: fas,
|
[TaskSimplifiedStatus.NonExistent]: far,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TaskIconComponent({className, title, icon, status, onInteract}: TaskIconProps) {
|
export function TaskIconComponent({className, title, icon, status, onInteract}: TaskIconProps) {
|
||||||
|
@ -31,7 +31,6 @@ export function TaskIconComponent({className, title, icon, status, onInteract}:
|
||||||
className={cn({
|
className={cn({
|
||||||
[style.taskIconComponent]: true,
|
[style.taskIconComponent]: true,
|
||||||
[style.taskIconComponentClickable]: clickable,
|
[style.taskIconComponentClickable]: clickable,
|
||||||
"fade": status === TaskSimplifiedStatus.Complete,
|
|
||||||
}, className)}
|
}, className)}
|
||||||
type={"button"}
|
type={"button"}
|
||||||
title={title}
|
title={title}
|
||||||
|
|
|
@ -15,8 +15,8 @@ const TASK_IMPORTANCE_TO_VALUE = {
|
||||||
const TASK_STATUS_TO_VALUE = {
|
const TASK_STATUS_TO_VALUE = {
|
||||||
"Journaled": 3,
|
"Journaled": 3,
|
||||||
"Complete": 2,
|
"Complete": 2,
|
||||||
"InProgress": 0,
|
"InProgress": 1,
|
||||||
"Unfinished": 1,
|
"Unfinished": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GROUPING_MODE_TO_GROUP_SORTER_FUNCTION = {
|
export const GROUPING_MODE_TO_GROUP_SORTER_FUNCTION = {
|
||||||
|
|
|
@ -26,23 +26,32 @@ export function useBoardLayoutEditor() {
|
||||||
])
|
])
|
||||||
const sortingHook = useCycler(useLocalStorage<number | undefined>(localStorageKeySorting, undefined), [
|
const sortingHook = useCycler(useLocalStorage<number | undefined>(localStorageKeySorting, undefined), [
|
||||||
[
|
[
|
||||||
SortingMode.ByDeadline,
|
|
||||||
SortingMode.ByImportance,
|
|
||||||
SortingMode.ByStatus,
|
SortingMode.ByStatus,
|
||||||
|
SortingMode.ByDeadline,
|
||||||
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
SortingMode.ByIcon,
|
SortingMode.ByIcon,
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByImportance,
|
SortingMode.ByStatus,
|
||||||
SortingMode.ByDeadline,
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByStatus,
|
SortingMode.ByDeadline,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
SortingMode.ByIcon,
|
SortingMode.ByIcon,
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByStatus,
|
SortingMode.ByStatus,
|
||||||
|
SortingMode.ByText,
|
||||||
|
SortingMode.ByIcon,
|
||||||
|
SortingMode.ByCreation,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
SortingMode.ByStatus,
|
||||||
|
SortingMode.ByCreation,
|
||||||
|
],
|
||||||
|
[
|
||||||
SortingMode.ByDeadline,
|
SortingMode.ByDeadline,
|
||||||
SortingMode.ByImportance,
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
|
@ -50,13 +59,17 @@ export function useBoardLayoutEditor() {
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByStatus,
|
|
||||||
SortingMode.ByImportance,
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByDeadline,
|
SortingMode.ByDeadline,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
SortingMode.ByIcon,
|
SortingMode.ByIcon,
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
SortingMode.ByText,
|
||||||
|
SortingMode.ByIcon,
|
||||||
|
SortingMode.ByCreation,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module version="4">
|
|
||||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
||||||
<exclude-output />
|
|
||||||
<content url="file://$MODULE_DIR$" />
|
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
|
||||||
</component>
|
|
||||||
</module>
|
|
|
@ -37,9 +37,8 @@ async fn main() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
let host = std::net::SocketAddr::from_str(&config::AXUM_HOST).expect("AXUM_HOST to be a valid SocketAddr");
|
log::info!("Starting web server!");
|
||||||
log::info!("Starting web server on: {host:?}");
|
axum::Server::bind(&std::net::SocketAddr::from_str(&config::AXUM_HOST).expect("AXUM_HOST to be a valid SocketAddr"))
|
||||||
axum::Server::bind(&host)
|
|
||||||
.serve(router.into_make_service())
|
.serve(router.into_make_service())
|
||||||
.await
|
.await
|
||||||
.expect("to be able to run the Axum server");
|
.expect("to be able to run the Axum server");
|
||||||
|
|
Loading…
Reference in a new issue