aboutsummaryrefslogtreecommitdiff
path: root/FrontEnd/src/app/views/settings/index.tsx
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-11-04 16:53:09 +0800
committercrupest <crupest@outlook.com>2020-11-04 16:53:09 +0800
commit6897006e1534bbeda60ed666f9c281220026ed54 (patch)
tree4801cdd4bba77bb89b7cd909fca7623782043ac9 /FrontEnd/src/app/views/settings/index.tsx
parent6900f348235f25336450910c8d71b4ffc3133818 (diff)
downloadtimeline-6897006e1534bbeda60ed666f9c281220026ed54.tar.gz
timeline-6897006e1534bbeda60ed666f9c281220026ed54.tar.bz2
timeline-6897006e1534bbeda60ed666f9c281220026ed54.zip
feat: Redesign settings ui.
Diffstat (limited to 'FrontEnd/src/app/views/settings/index.tsx')
-rw-r--r--FrontEnd/src/app/views/settings/index.tsx109
1 files changed, 54 insertions, 55 deletions
diff --git a/FrontEnd/src/app/views/settings/index.tsx b/FrontEnd/src/app/views/settings/index.tsx
index 4d4f18b5..513885e8 100644
--- a/FrontEnd/src/app/views/settings/index.tsx
+++ b/FrontEnd/src/app/views/settings/index.tsx
@@ -1,7 +1,7 @@
import React, { useState } from "react";
import { useHistory } from "react-router";
import { useTranslation } from "react-i18next";
-import { Form, Container, Row, Col, Button, Modal } from "react-bootstrap";
+import { Form, Row, Col, Button, Modal } from "react-bootstrap";
import { useUser, userService } from "@/services/user";
import OperationDialog from "../common/OperationDialog";
@@ -105,62 +105,61 @@ const SettingsPage: React.FC = (_) => {
const language = i18n.language.slice(0, 2);
return (
- <Container fluid>
+ <>
{user ? (
- <>
- <Row className="border-bottom p-3 cursor-pointer">
- <Col xs="12">
- <h5
- onClick={() => {
- history.push(`/users/${user.username}`);
- }}
- >
- {t("settings.gotoSelf")}
- </h5>
- </Col>
- </Row>
- <Row className="border-bottom p-3 cursor-pointer">
- <Col xs="12">
- <h5
- className="text-danger"
- onClick={() => setDialog("changepassword")}
- >
- {t("settings.changePassword")}
- </h5>
- </Col>
- </Row>
- <Row className="border-bottom p-3 cursor-pointer">
- <Col xs="12">
- <h5
- className="text-danger"
- onClick={() => {
- setDialog("logout");
- }}
- >
- {t("settings.logout")}
- </h5>
- </Col>
- </Row>
- </>
- ) : null}
- <Row className="align-items-center border-bottom p-3">
- <Col xs="12" sm="auto">
- <h5>{t("settings.languagePrimary")}</h5>
- <p>{t("settings.languageSecondary")}</p>
- </Col>
- <Col xs="auto" className="ml-auto">
- <Form.Control
- as="select"
- value={language}
- onChange={(e) => {
- void i18n.changeLanguage(e.target.value);
+ <div className="cru-card m-3 py-3">
+ <h3 className="px-3 mb-3 text-primary">
+ {t("settings.subheaders.account")}
+ </h3>
+ <div
+ className="settings-item clickable first"
+ onClick={() => {
+ history.push(`/users/${user.username}`);
}}
>
- <option value="zh">中文</option>
- <option value="en">English</option>
- </Form.Control>
- </Col>
- </Row>
+ {t("settings.gotoSelf")}
+ </div>
+ <div
+ className="settings-item clickable text-danger"
+ onClick={() => setDialog("changepassword")}
+ >
+ {t("settings.changePassword")}
+ </div>
+ <div
+ className="settings-item clickable text-danger"
+ onClick={() => {
+ setDialog("logout");
+ }}
+ >
+ {t("settings.logout")}
+ </div>
+ </div>
+ ) : null}
+ <div className="cru-card m-3 py-3">
+ <h3 className="px-3 mb-3 text-primary">
+ {t("settings.subheaders.customization")}
+ </h3>
+ <Row className="settings-item first mx-0">
+ <Col xs="12" sm="auto">
+ <div>{t("settings.languagePrimary")}</div>
+ <small className="d-block text-secondary">
+ {t("settings.languageSecondary")}
+ </small>
+ </Col>
+ <Col xs="auto" className="ml-auto">
+ <Form.Control
+ as="select"
+ value={language}
+ onChange={(e) => {
+ void i18n.changeLanguage(e.target.value);
+ }}
+ >
+ <option value="zh">中文</option>
+ <option value="en">English</option>
+ </Form.Control>
+ </Col>
+ </Row>
+ </div>
{(() => {
switch (dialog) {
case "changepassword":
@@ -187,7 +186,7 @@ const SettingsPage: React.FC = (_) => {
return null;
}
})()}
- </Container>
+ </>
);
};