mirror of
https://github.com/Steffo99/todocolors.git
synced 2025-01-02 20:24:19 +00:00
Compare commits
7 commits
74b3336ea1
...
998b000089
Author | SHA1 | Date | |
---|---|---|---|
998b000089 | |||
873794eee5 | |||
a266d3e6f0 | |||
492acaae12 | |||
083267782d | |||
63b59bf0eb | |||
0f5fdb038b |
7 changed files with 53 additions and 37 deletions
|
@ -6,7 +6,7 @@
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"theme_color": "#0d193b",
|
"theme_color": "#0d193b",
|
||||||
"background_color": "#0c193b",
|
"background_color": "#0c193b",
|
||||||
"description": "Self-hostable multiplayer todo app",
|
"description": "Multiplayer todo app",
|
||||||
"categories": ["productivity"],
|
"categories": ["productivity"],
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,9 +4,15 @@ 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"
|
||||||
|
|
||||||
// ahhh i love typescript shenanigans
|
type Attempt = {
|
||||||
// @ts-ignore
|
year?: number,
|
||||||
const DATE_FROM_STRING = dateParser.fromString;
|
month?: number,
|
||||||
|
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,
|
||||||
|
@ -23,9 +29,22 @@ 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 deadlineDate: Date | undefined = deadlineGroup === undefined ? undefined : DATE_FROM_STRING(deadlineGroup, lang) ?? undefined
|
const deadlineAttempt: Attempt | undefined = deadlineGroup === undefined ? undefined : dateParser.attempt(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]: fal,
|
[TaskSimplifiedStatus.Unfinished]: fas,
|
||||||
[TaskSimplifiedStatus.InProgress]: far,
|
[TaskSimplifiedStatus.InProgress]: fas,
|
||||||
[TaskSimplifiedStatus.Complete]: fas,
|
[TaskSimplifiedStatus.Complete]: fal,
|
||||||
[TaskSimplifiedStatus.Journaled]: fas,
|
[TaskSimplifiedStatus.Journaled]: far,
|
||||||
[TaskSimplifiedStatus.NonExistent]: far,
|
[TaskSimplifiedStatus.NonExistent]: fas,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function TaskIconComponent({className, title, icon, status, onInteract}: TaskIconProps) {
|
export function TaskIconComponent({className, title, icon, status, onInteract}: TaskIconProps) {
|
||||||
|
@ -31,6 +31,7 @@ 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": 1,
|
"InProgress": 0,
|
||||||
"Unfinished": 0,
|
"Unfinished": 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const GROUPING_MODE_TO_GROUP_SORTER_FUNCTION = {
|
export const GROUPING_MODE_TO_GROUP_SORTER_FUNCTION = {
|
||||||
|
|
|
@ -26,50 +26,37 @@ 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.ByStatus,
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByImportance,
|
SortingMode.ByDeadline,
|
||||||
SortingMode.ByDeadline,
|
SortingMode.ByStatus,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
SortingMode.ByIcon,
|
SortingMode.ByIcon,
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByStatus,
|
SortingMode.ByStatus,
|
||||||
|
SortingMode.ByDeadline,
|
||||||
|
SortingMode.ByImportance,
|
||||||
SortingMode.ByText,
|
SortingMode.ByText,
|
||||||
SortingMode.ByIcon,
|
SortingMode.ByIcon,
|
||||||
SortingMode.ByCreation,
|
SortingMode.ByCreation,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
SortingMode.ByStatus,
|
SortingMode.ByStatus,
|
||||||
SortingMode.ByCreation,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
SortingMode.ByDeadline,
|
|
||||||
SortingMode.ByImportance,
|
|
||||||
SortingMode.ByText,
|
|
||||||
SortingMode.ByIcon,
|
|
||||||
SortingMode.ByCreation,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
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,
|
||||||
]
|
]
|
||||||
|
|
8
todocolors.iml
Normal file
8
todocolors.iml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<?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,8 +37,9 @@ async fn main() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
log::info!("Starting web server!");
|
let host = std::net::SocketAddr::from_str(&config::AXUM_HOST).expect("AXUM_HOST to be a valid SocketAddr");
|
||||||
axum::Server::bind(&std::net::SocketAddr::from_str(&config::AXUM_HOST).expect("AXUM_HOST to be a valid SocketAddr"))
|
log::info!("Starting web server on: {host:?}");
|
||||||
|
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