summaryrefslogtreecommitdiffstats
path: root/front/config.jsx
diff options
context:
space:
mode:
authorsyn <isaqtm@gmail.com>2021-03-08 20:11:17 +0300
committersyn <isaqtm@gmail.com>2021-03-08 20:11:17 +0300
commit82b3f4c5e419bd6fdaa0dae14c92586b51aee8d7 (patch)
tree1f1a5b02549d65565237bb3362253f7d5486228b /front/config.jsx
downloadupnet-82b3f4c5e419bd6fdaa0dae14c92586b51aee8d7.tar.gz
mvp
Diffstat (limited to 'front/config.jsx')
-rw-r--r--front/config.jsx49
1 files changed, 49 insertions, 0 deletions
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>
+ }
+}