From 82b3f4c5e419bd6fdaa0dae14c92586b51aee8d7 Mon Sep 17 00:00:00 2001
From: syn <isaqtm@gmail.com>
Date: Mon, 8 Mar 2021 20:11:17 +0300
Subject: mvp

---
 front/config.jsx | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 front/config.jsx

(limited to 'front/config.jsx')

diff --git a/front/config.jsx b/front/config.jsx
new file mode 100644
index 0000000..51373cc
--- /dev/null
+++ b/front/config.jsx
@@ -0,0 +1,49 @@
+import "preact/debug";
+import { Component, Fragment, h } from 'preact';
+import strftime from 'strftime';
+/** @jsx h */
+/** @jsxFrag Fragment */
+
+export class Config {
+    static getBrowserTimezoneOffset() {
+        return - new Date().getTimezoneOffset();
+    }
+
+    getDateFormatter() {
+        let strftime_with_offset = strftime.timezone(this.timezoneOffset);
+        if (this.time.locale != null) {
+            return strftime_with_offset.localizeByIdentifier(props.locale);
+        } else {
+            this.state = { formatTime: strftime_with_offset }
+        }
+    }
+
+    constructor() {
+        this.time = {
+            locale: null,
+            timezoneOffset: this.constructor.getBrowserTimezoneOffset(),
+            defaultDate: {
+                type: "current",
+                format: "%Y-%m-%d %H:%M"
+            },
+        }
+    }
+
+    getDefaultDate() {
+        if (this.time.defaultDate.type == "current")
+            return strftime(this.time.defaultDate.format, new Date())
+        else
+            return ""
+    }
+}
+
+export class ConfigView extends Component {
+    constructor(props) {
+        super(props);
+        this.configRef = props.config;
+    }
+
+    render() {
+        return <a class="a-button" onClick={e => alert("not supported now")}>conf</a>
+    }
+}
-- 
cgit v1.2.1-18-gbd029

