diff --git a/app/src/components/DoorTemplate.astro b/app/src/components/DoorTemplate.astro
index b2c616b..199467d 100644
--- a/app/src/components/DoorTemplate.astro
+++ b/app/src/components/DoorTemplate.astro
@@ -10,13 +10,16 @@ const t = useTranslations(lang)
@@ -24,10 +27,20 @@ const t = useTranslations(lang)
-
-
- {t("batteryLow")}
-
+
+
+
+ {t("lock.batteryLow")}
+
+
+
+ {t("lock.unreachable")}
+
+
+
+ {t("lock.jammed")}
+
+
@@ -40,21 +53,25 @@ const t = useTranslations(lang)
-
+
- {t("state.open")}
+ {t("state.unlocked")}
-
+
- {t("state.closed")}
+ {t("state.locked")}
{t("state.unknown")}
-
+
- {t("state.moving")}
+ {t("state.unlocking")}
+
+
+
+ {t("state.locking")}
diff --git a/app/src/i18n/ui.ts b/app/src/i18n/ui.ts
index 99ce36f..79694fb 100644
--- a/app/src/i18n/ui.ts
+++ b/app/src/i18n/ui.ts
@@ -13,11 +13,14 @@ export const ui = {
"unauthenticated.title": "Unauthenticated",
"unauthenticated.description": `To use the locks you have to log in with your CCCHH ID and have the "intern@" status.
More infos: CCCHH Wiki`,
- "state.open": "Open",
- "state.closed": "Closed",
+ "state.unlocked": "Open",
+ "state.locked": "Closed",
"state.unknown": "Unknown",
- "state.moving": "Moving",
- "batteryLow": "Battery low",
+ "state.unlocking": "Unlocking",
+ "state.locking": "Locking",
+ "lock.batteryLow": "Battery low",
+ "lock.unreachable": "Unreachable",
+ "lock.jammed": "Lock jammed",
"button.open": "Open",
"button.close": "Close",
"login": "Login",
@@ -29,11 +32,14 @@ export const ui = {
"unauthenticated.title": "Nicht angemeldet",
"unauthenticated.description": `Um die Schlösser bedienen zu können, musst du dich mit deiner CCCHH ID anmelden und den "intern@" Status haben.
Weitere Infos: CCCHH Wiki`,
- "state.open": "Offen",
- "state.closed": "Geschlossen",
+ "state.unlocked": "Offen",
+ "state.locked": "Geschlossen",
"state.unknown": "Unbekannt",
- "state.moving": "In Bewegung",
- "batteryLow": "Batterie fast leer",
+ "state.unlocking": "Öffnet",
+ "state.locking": "Schließt",
+ "lock.batteryLow": "Batterie fast leer",
+ "lock.unreachable": "Nicht erreichbar",
+ "lock.jammed": "Schloss blockiert",
"button.open": "Öffnen",
"button.close": "Schließen",
"login": "Anmelden",
diff --git a/app/src/pages/[lang]/index.astro b/app/src/pages/[lang]/index.astro
index a924df2..ed3ab64 100644
--- a/app/src/pages/[lang]/index.astro
+++ b/app/src/pages/[lang]/index.astro
@@ -59,8 +59,10 @@ const t = useTranslations(lang)
type DoorType = {
id: string;
label: string;
- state: "open" | "closed" | "unknown" | "moving";
+ state: "unlocked" | "locked" | "unknown" | "unlocking" | "locking";
batteryLow: boolean;
+ unreachable: boolean;
+ jammed: boolean;
}
type AuthType = {
username: string;
@@ -79,14 +81,18 @@ const t = useTranslations(lang)
{
id: "abcdef",
label: "Hauptraum",
- state: "open",
+ state: "unlocked",
batteryLow: false,
+ unreachable: false,
+ jammed: false,
},
{
id: "12345",
label: "Werkstatt",
- state: "closed",
+ state: "locked",
batteryLow: true,
+ unreachable: false,
+ jammed: false,
},
]
@@ -94,12 +100,10 @@ const t = useTranslations(lang)
const getUserInfo = fetcher.path("/api/user-info/").method("get").create()
try {
- const {status, data: userInfo} = await getUserInfo({
- status: ["available", "pending"],
- })
+ const {status, data: userInfo} = await getUserInfo({})
auth.authenticated = userInfo.is_logged_in
- auth.authorized = false
+ auth.authorized = true
auth.until = userInfo.guaranteed_session_until ? new Date(userInfo.guaranteed_session_until) : null
auth.username = userInfo.user_info?.username ?? ''
} catch (e) {
@@ -140,10 +144,22 @@ const t = useTranslations(lang)
delete doorElement.dataset.battery
}
+ if (door.unreachable) {
+ doorElement.dataset.unreachable = ""
+ } else {
+ delete doorElement.dataset.unreachable
+ }
+
+ if (door.jammed) {
+ doorElement.dataset.jammed = ""
+ } else {
+ delete doorElement.dataset.jammed
+ }
+
labelElement.innerHTML = door.label
buttonElements.forEach(button => {
- button.disabled = door.state === "moving"
+ button.disabled = ["unlocking", "locking"].includes(door.state)
})
}
@@ -184,13 +200,17 @@ const t = useTranslations(lang)
id: "abcdef",
label: "Hauptraum",
state: "unknown",
- batteryLow: false,
+ batteryLow: true,
+ unreachable: false,
+ jammed: true,
}
doors[1] = {
id: "12345",
label: "Werkstatt",
- state: "moving",
- batteryLow: true,
+ state: "unlocking",
+ batteryLow: false,
+ unreachable: true,
+ jammed: false,
}
refresh()
}, 2000)