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",
|
||||
"theme_color": "#0d193b",
|
||||
"background_color": "#0c193b",
|
||||
"description": "Self-hostable multiplayer todo app",
|
||||
"description": "Multiplayer todo app",
|
||||
"categories": ["productivity"],
|
||||
"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 {default as dateParser} from "any-date-parser"
|
||||
|
||||
// ahhh i love typescript shenanigans
|
||||
// @ts-ignore
|
||||
const DATE_FROM_STRING = dateParser.fromString;
|
||||
type Attempt = {
|
||||
year?: number,
|
||||
month?: number,
|
||||
day?: number,
|
||||
hour?: number,
|
||||
minute?: number,
|
||||
second?: number,
|
||||
millisecond?: number,
|
||||
}
|
||||
|
||||
const VALUE_TO_TASK_IMPORTANCE = {
|
||||
"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 icon: string = iconMatch?.[1]?.trim() ?? ICON_DEFAULT
|
||||
|
||||
const now = new Date()
|
||||
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
|
||||
|
||||
console.debug("[convertSTT]", "\ngroup:", deadlineGroup, "\ndate:", deadlineDate, "\ntimestamp:", deadline)
|
||||
|
||||
// TODO: Splice so the regexes aren't executed twice
|
||||
text = text.replace(IMPORTANCE_GLYPH_RE, "")
|
||||
|
|
|
@ -16,11 +16,11 @@ type TaskIconProps = {
|
|||
}
|
||||
|
||||
const STATUS_TO_PREFIX: {[t in TaskSimplifiedStatus]: IconPack} = {
|
||||
[TaskSimplifiedStatus.Unfinished]: fal,
|
||||
[TaskSimplifiedStatus.InProgress]: far,
|
||||
[TaskSimplifiedStatus.Complete]: fas,
|
||||
[TaskSimplifiedStatus.Journaled]: fas,
|
||||
[TaskSimplifiedStatus.NonExistent]: far,
|
||||
[TaskSimplifiedStatus.Unfinished]: fas,
|
||||
[TaskSimplifiedStatus.InProgress]: fas,
|
||||
[TaskSimplifiedStatus.Complete]: fal,
|
||||
[TaskSimplifiedStatus.Journaled]: far,
|
||||
[TaskSimplifiedStatus.NonExistent]: fas,
|
||||
}
|
||||
|
||||
export function TaskIconComponent({className, title, icon, status, onInteract}: TaskIconProps) {
|
||||
|
@ -31,6 +31,7 @@ export function TaskIconComponent({className, title, icon, status, onInteract}:
|
|||
className={cn({
|
||||
[style.taskIconComponent]: true,
|
||||
[style.taskIconComponentClickable]: clickable,
|
||||
"fade": status === TaskSimplifiedStatus.Complete,
|
||||
}, className)}
|
||||
type={"button"}
|
||||
title={title}
|
||||
|
|
|
@ -15,8 +15,8 @@ const TASK_IMPORTANCE_TO_VALUE = {
|
|||
const TASK_STATUS_TO_VALUE = {
|
||||
"Journaled": 3,
|
||||
"Complete": 2,
|
||||
"InProgress": 1,
|
||||
"Unfinished": 0,
|
||||
"InProgress": 0,
|
||||
"Unfinished": 1,
|
||||
}
|
||||
|
||||
export const GROUPING_MODE_TO_GROUP_SORTER_FUNCTION = {
|
||||
|
|
|
@ -26,50 +26,37 @@ export function useBoardLayoutEditor() {
|
|||
])
|
||||
const sortingHook = useCycler(useLocalStorage<number | undefined>(localStorageKeySorting, undefined), [
|
||||
[
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByStatus,
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByStatus,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByStatus,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByStatus,
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByStatus,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByImportance,
|
||||
SortingMode.ByDeadline,
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
SortingMode.ByCreation,
|
||||
],
|
||||
[
|
||||
SortingMode.ByText,
|
||||
SortingMode.ByIcon,
|
||||
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!");
|
||||
axum::Server::bind(&std::net::SocketAddr::from_str(&config::AXUM_HOST).expect("AXUM_HOST to be a valid SocketAddr"))
|
||||
let host = 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())
|
||||
.await
|
||||
.expect("to be able to run the Axum server");
|
||||
|
|
Loading…
Reference in a new issue