aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FrontEnd/package.json3
-rw-r--r--FrontEnd/src/app/views/admin/UserAdmin.tsx37
-rw-r--r--FrontEnd/src/app/views/center/TimelineBoard.tsx16
-rw-r--r--FrontEnd/src/app/views/common/ImageCropper.tsx5
-rw-r--r--FrontEnd/src/app/views/common/OperationDialog.tsx4
-rw-r--r--FrontEnd/src/app/views/home/index.tsx10
-rw-r--r--FrontEnd/src/app/views/search/index.tsx7
-rw-r--r--FrontEnd/src/app/views/settings/ChangeAvatarDialog.tsx25
-rw-r--r--FrontEnd/src/app/views/settings/index.tsx7
-rw-r--r--FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx6
-rw-r--r--FrontEnd/src/app/views/timeline-common/Timeline.tsx7
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx7
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx6
-rw-r--r--FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx119
-rw-r--r--FrontEnd/src/app/views/timeline/TimelineCard.tsx5
-rw-r--r--FrontEnd/src/app/views/user/UserCard.tsx5
16 files changed, 131 insertions, 138 deletions
diff --git a/FrontEnd/package.json b/FrontEnd/package.json
index 52952d0e..04ad248d 100644
--- a/FrontEnd/package.json
+++ b/FrontEnd/package.json
@@ -41,7 +41,8 @@
"scripts": {
"start": "webpack serve --config ./webpack.config.dev.js",
"build": "webpack --config ./webpack.config.prod.js",
- "lint": "eslint src/ --ext .js --ext .jsx --ext .ts --ext .tsx"
+ "lint": "eslint src/ --ext .js --ext .jsx --ext .ts --ext .tsx",
+ "lint:fix": "eslint src/ --ext .js --ext .jsx --ext .ts --ext .tsx --fix"
},
"browserslist": {
"production": [
diff --git a/FrontEnd/src/app/views/admin/UserAdmin.tsx b/FrontEnd/src/app/views/admin/UserAdmin.tsx
index 26c40a33..558d3aee 100644
--- a/FrontEnd/src/app/views/admin/UserAdmin.tsx
+++ b/FrontEnd/src/app/views/admin/UserAdmin.tsx
@@ -55,25 +55,24 @@ const UsernameLabel: React.FC = (props) => {
return <span style={{ color: "blue" }}>{props.children}</span>;
};
-const UserDeleteDialog: React.FC<
- DialogProps<{ username: string }, unknown>
-> = ({ open, close, data: { username }, onSuccess }) => {
- return (
- <OperationDialog
- open={open}
- close={close}
- title="admin:user.dialog.delete.title"
- themeColor="danger"
- inputPrompt={() => (
- <Trans i18nKey="admin:user.dialog.delete.prompt">
- 0<UsernameLabel>{username}</UsernameLabel>2
- </Trans>
- )}
- onProcess={() => getHttpUserClient().delete(username)}
- onSuccessAndClose={onSuccess}
- />
- );
-};
+const UserDeleteDialog: React.FC<DialogProps<{ username: string }, unknown>> =
+ ({ open, close, data: { username }, onSuccess }) => {
+ return (
+ <OperationDialog
+ open={open}
+ close={close}
+ title="admin:user.dialog.delete.title"
+ themeColor="danger"
+ inputPrompt={() => (
+ <Trans i18nKey="admin:user.dialog.delete.prompt">
+ 0<UsernameLabel>{username}</UsernameLabel>2
+ </Trans>
+ )}
+ onProcess={() => getHttpUserClient().delete(username)}
+ onSuccessAndClose={onSuccess}
+ />
+ );
+ };
const UserModifyDialog: React.FC<
DialogProps<
diff --git a/FrontEnd/src/app/views/center/TimelineBoard.tsx b/FrontEnd/src/app/views/center/TimelineBoard.tsx
index 35249f66..8cede394 100644
--- a/FrontEnd/src/app/views/center/TimelineBoard.tsx
+++ b/FrontEnd/src/app/views/center/TimelineBoard.tsx
@@ -111,11 +111,12 @@ const TimelineBoardItemContainer: React.FC<TimelineBoardItemContainerProps> = ({
timelines,
editHandler,
}) => {
- const [moveState, setMoveState] = React.useState<null | {
- index: number;
- offset: number;
- startPointY: number;
- }>(null);
+ const [moveState, setMoveState] =
+ React.useState<null | {
+ index: number;
+ offset: number;
+ startPointY: number;
+ }>(null);
return (
<>
@@ -306,9 +307,8 @@ const TimelineBoard: React.FC<TimelineBoardProps> = ({
load,
editHandler,
}) => {
- const [timelines, setTimelines] = React.useState<
- HttpTimelineInfo[] | "offline" | "loading"
- >("loading");
+ const [timelines, setTimelines] =
+ React.useState<HttpTimelineInfo[] | "offline" | "loading">("loading");
React.useEffect(() => {
let subscribe = true;
diff --git a/FrontEnd/src/app/views/common/ImageCropper.tsx b/FrontEnd/src/app/views/common/ImageCropper.tsx
index 2ef5b7ed..371ab0b1 100644
--- a/FrontEnd/src/app/views/common/ImageCropper.tsx
+++ b/FrontEnd/src/app/views/common/ImageCropper.tsx
@@ -40,9 +40,8 @@ export interface ImageCropperProps {
const ImageCropper = (props: ImageCropperProps): React.ReactElement => {
const { clip, imageUrl, onChange, imageElementCallback, className } = props;
- const [oldState, setOldState] = React.useState<ImageCropperSavedState | null>(
- null
- );
+ const [oldState, setOldState] =
+ React.useState<ImageCropperSavedState | null>(null);
const [imageInfo, setImageInfo] = React.useState<ImageInfo | null>(null);
const normalizeClip = (c: Clip | null | undefined): NormailizedClip => {
diff --git a/FrontEnd/src/app/views/common/OperationDialog.tsx b/FrontEnd/src/app/views/common/OperationDialog.tsx
index c9fa709f..6a5228f9 100644
--- a/FrontEnd/src/app/views/common/OperationDialog.tsx
+++ b/FrontEnd/src/app/views/common/OperationDialog.tsx
@@ -186,7 +186,7 @@ const OperationDialog = <
setStep({ type: "process" });
props
.onProcess(
- (values as unknown) as MapOperationInputInfoValueTypeList<OperationInputInfoList>
+ values as unknown as MapOperationInputInfoValueTypeList<OperationInputInfoList>
)
.then(
(d) => {
@@ -218,7 +218,7 @@ const OperationDialog = <
const { inputValidator } = props;
if (inputValidator != null) {
const result = inputValidator(
- (values as unknown) as MapOperationInputInfoValueTypeList<OperationInputInfoList>
+ values as unknown as MapOperationInputInfoValueTypeList<OperationInputInfoList>
);
setInputError(result);
return isNoError(result);
diff --git a/FrontEnd/src/app/views/home/index.tsx b/FrontEnd/src/app/views/home/index.tsx
index 0eca23ee..484260b0 100644
--- a/FrontEnd/src/app/views/home/index.tsx
+++ b/FrontEnd/src/app/views/home/index.tsx
@@ -19,12 +19,10 @@ const HomeV2: React.FC = () => {
const [navText, setNavText] = React.useState<string>("");
- const [highlightTimelineState, setHighlightTimelineState] = React.useState<
- "loading" | "done" | "error"
- >("loading");
- const [highlightTimelines, setHighlightTimelines] = React.useState<
- HttpTimelineInfo[] | undefined
- >();
+ const [highlightTimelineState, setHighlightTimelineState] =
+ React.useState<"loading" | "done" | "error">("loading");
+ const [highlightTimelines, setHighlightTimelines] =
+ React.useState<HttpTimelineInfo[] | undefined>();
React.useEffect(() => {
if (highlightTimelineState === "loading") {
diff --git a/FrontEnd/src/app/views/search/index.tsx b/FrontEnd/src/app/views/search/index.tsx
index 966ca666..ddb68f87 100644
--- a/FrontEnd/src/app/views/search/index.tsx
+++ b/FrontEnd/src/app/views/search/index.tsx
@@ -49,9 +49,10 @@ const SearchPage: React.FC = () => {
const queryParam = searchParams.get("q");
const [searchText, setSearchText] = React.useState<string>("");
- const [state, setState] = React.useState<
- HttpTimelineInfo[] | "init" | "loading" | "network-error" | "error"
- >("init");
+ const [state, setState] =
+ React.useState<
+ HttpTimelineInfo[] | "init" | "loading" | "network-error" | "error"
+ >("init");
const [forceResearchKey, setForceResearchKey] = React.useState<number>(0);
diff --git a/FrontEnd/src/app/views/settings/ChangeAvatarDialog.tsx b/FrontEnd/src/app/views/settings/ChangeAvatarDialog.tsx
index 53ffbc8d..bad21dd5 100644
--- a/FrontEnd/src/app/views/settings/ChangeAvatarDialog.tsx
+++ b/FrontEnd/src/app/views/settings/ChangeAvatarDialog.tsx
@@ -24,22 +24,21 @@ const ChangeAvatarDialog: React.FC<ChangeAvatarDialogProps> = (props) => {
const [file, setFile] = React.useState<File | null>(null);
const [fileUrl, setFileUrl] = React.useState<string | null>(null);
const [clip, setClip] = React.useState<Clip | null>(null);
- const [
- cropImgElement,
- setCropImgElement,
- ] = React.useState<HTMLImageElement | null>(null);
+ const [cropImgElement, setCropImgElement] =
+ React.useState<HTMLImageElement | null>(null);
const [resultBlob, setResultBlob] = React.useState<Blob | null>(null);
const [resultUrl, setResultUrl] = React.useState<string | null>(null);
- const [state, setState] = React.useState<
- | "select"
- | "crop"
- | "processcrop"
- | "preview"
- | "uploading"
- | "success"
- | "error"
- >("select");
+ const [state, setState] =
+ React.useState<
+ | "select"
+ | "crop"
+ | "processcrop"
+ | "preview"
+ | "uploading"
+ | "success"
+ | "error"
+ >("select");
const [message, setMessage] = useState<
string | { type: "custom"; text: string } | null
diff --git a/FrontEnd/src/app/views/settings/index.tsx b/FrontEnd/src/app/views/settings/index.tsx
index 04a2777a..9f955121 100644
--- a/FrontEnd/src/app/views/settings/index.tsx
+++ b/FrontEnd/src/app/views/settings/index.tsx
@@ -40,9 +40,10 @@ const SettingsPage: React.FC = (_) => {
const user = useUser();
const history = useHistory();
- const [dialog, setDialog] = useState<
- null | "changepassword" | "changeavatar" | "changenickname" | "logout"
- >(null);
+ const [dialog, setDialog] =
+ useState<
+ null | "changepassword" | "changeavatar" | "changenickname" | "logout"
+ >(null);
const language = i18n.language.slice(0, 2);
diff --git a/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx b/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
index 2e569b7c..6d0e5431 100644
--- a/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
+++ b/FrontEnd/src/app/views/timeline-common/MarkdownPostEdit.tsx
@@ -34,10 +34,8 @@ const MarkdownPostEdit: React.FC<MarkdownPostEditProps> = ({
const [process, setProcess] = React.useState<boolean>(false);
- const [
- showLeaveConfirmDialog,
- setShowLeaveConfirmDialog,
- ] = React.useState<boolean>(false);
+ const [showLeaveConfirmDialog, setShowLeaveConfirmDialog] =
+ React.useState<boolean>(false);
const [text, _setText] = React.useState<string>("");
const [images, _setImages] = React.useState<{ file: File; url: string }[]>(
diff --git a/FrontEnd/src/app/views/timeline-common/Timeline.tsx b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
index 72d38ffd..32d0bdd5 100644
--- a/FrontEnd/src/app/views/timeline-common/Timeline.tsx
+++ b/FrontEnd/src/app/views/timeline-common/Timeline.tsx
@@ -22,9 +22,10 @@ export interface TimelineProps {
const Timeline: React.FC<TimelineProps> = (props) => {
const { timelineName, className, style, reloadKey, onReload } = props;
- const [state, setState] = React.useState<
- "loading" | "loaded" | "offline" | "notexist" | "forbid" | "error"
- >("loading");
+ const [state, setState] =
+ React.useState<
+ "loading" | "loaded" | "offline" | "notexist" | "forbid" | "error"
+ >("loading");
const [posts, setPosts] = React.useState<HttpTimelinePostInfo[]>([]);
React.useEffect(() => {
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
index baaad139..81a3c179 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePageTemplate.tsx
@@ -34,9 +34,10 @@ const TimelinePageTemplate: React.FC<TimelinePageTemplateProps> = (props) => {
const { t } = useTranslation();
- const [state, setState] = React.useState<
- "loading" | "done" | "offline" | "notexist" | "error"
- >("loading");
+ const [state, setState] =
+ React.useState<"loading" | "done" | "offline" | "notexist" | "error">(
+ "loading"
+ );
const [timeline, setTimeline] = React.useState<HttpTimelineInfo | null>(null);
useReverseScrollPositionRemember();
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
index 6bd6ea98..c9fec919 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePostView.tsx
@@ -24,10 +24,8 @@ const TimelinePostView: React.FC<TimelinePostViewProps> = (props) => {
const { post, className, style, cardStyle, onDeleted } = props;
const current = props.current === true;
- const [
- operationMaskVisible,
- setOperationMaskVisible,
- ] = React.useState<boolean>(false);
+ const [operationMaskVisible, setOperationMaskVisible] =
+ React.useState<boolean>(false);
const [deleteDialog, setDeleteDialog] = React.useState<boolean>(false);
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
diff --git a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
index c65e097d..f63b2b45 100644
--- a/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
+++ b/FrontEnd/src/app/views/timeline-common/TimelinePropertyChangeDialog.tsx
@@ -23,67 +23,66 @@ const labelMap: { [key in TimelineVisibility]: string } = {
Register: "timeline.visibility.register",
};
-const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps> = (
- props
-) => {
- const { timeline, onChange } = props;
+const TimelinePropertyChangeDialog: React.FC<TimelinePropertyChangeDialogProps> =
+ (props) => {
+ const { timeline, onChange } = props;
- return (
- <OperationDialog
- title={"timeline.dialogChangeProperty.title"}
- inputScheme={
- [
- {
- type: "text",
- label: "timeline.dialogChangeProperty.titleField",
- initValue: timeline.title,
- },
- {
- type: "select",
- label: "timeline.dialogChangeProperty.visibility",
- options: kTimelineVisibilities.map((v) => ({
- label: labelMap[v],
- value: v,
- })),
- initValue: timeline.visibility,
- },
- {
- type: "text",
- label: "timeline.dialogChangeProperty.description",
- initValue: timeline.description,
- },
- {
- type: "color",
- label: "timeline.dialogChangeProperty.color",
- initValue: timeline.color ?? null,
- disableAlpha: true,
- canBeNull: true,
- },
- ] as const
- }
- open={props.open}
- close={props.close}
- onProcess={([newTitle, newVisibility, newDescription, newColor]) => {
- const req: HttpTimelinePatchRequest = {};
- if (newTitle !== timeline.title) {
- req.title = newTitle;
+ return (
+ <OperationDialog
+ title={"timeline.dialogChangeProperty.title"}
+ inputScheme={
+ [
+ {
+ type: "text",
+ label: "timeline.dialogChangeProperty.titleField",
+ initValue: timeline.title,
+ },
+ {
+ type: "select",
+ label: "timeline.dialogChangeProperty.visibility",
+ options: kTimelineVisibilities.map((v) => ({
+ label: labelMap[v],
+ value: v,
+ })),
+ initValue: timeline.visibility,
+ },
+ {
+ type: "text",
+ label: "timeline.dialogChangeProperty.description",
+ initValue: timeline.description,
+ },
+ {
+ type: "color",
+ label: "timeline.dialogChangeProperty.color",
+ initValue: timeline.color ?? null,
+ disableAlpha: true,
+ canBeNull: true,
+ },
+ ] as const
}
- if (newVisibility !== timeline.visibility) {
- req.visibility = newVisibility as TimelineVisibility;
- }
- if (newDescription !== timeline.description) {
- req.description = newDescription;
- }
- const nc = newColor ?? "#007bff";
- if (nc !== timeline.color) {
- req.color = nc;
- }
- return getHttpTimelineClient()
- .patchTimeline(timeline.name, req)
- .then(onChange);
- }}
- />
- );
-};
+ open={props.open}
+ close={props.close}
+ onProcess={([newTitle, newVisibility, newDescription, newColor]) => {
+ const req: HttpTimelinePatchRequest = {};
+ if (newTitle !== timeline.title) {
+ req.title = newTitle;
+ }
+ if (newVisibility !== timeline.visibility) {
+ req.visibility = newVisibility as TimelineVisibility;
+ }
+ if (newDescription !== timeline.description) {
+ req.description = newDescription;
+ }
+ const nc = newColor ?? "#007bff";
+ if (nc !== timeline.color) {
+ req.color = nc;
+ }
+ return getHttpTimelineClient()
+ .patchTimeline(timeline.name, req)
+ .then(onChange);
+ }}
+ />
+ );
+ };
export default TimelinePropertyChangeDialog;
diff --git a/FrontEnd/src/app/views/timeline/TimelineCard.tsx b/FrontEnd/src/app/views/timeline/TimelineCard.tsx
index f2aca579..0cb908cc 100644
--- a/FrontEnd/src/app/views/timeline/TimelineCard.tsx
+++ b/FrontEnd/src/app/views/timeline/TimelineCard.tsx
@@ -9,9 +9,8 @@ import TimelineDeleteDialog from "./TimelineDeleteDialog";
const TimelineCard: React.FC<TimelinePageCardProps> = (props) => {
const { timeline } = props;
- const [dialog, setDialog] = React.useState<
- "member" | "property" | "delete" | null
- >(null);
+ const [dialog, setDialog] =
+ React.useState<"member" | "property" | "delete" | null>(null);
return (
<>
diff --git a/FrontEnd/src/app/views/user/UserCard.tsx b/FrontEnd/src/app/views/user/UserCard.tsx
index 067366e0..df332706 100644
--- a/FrontEnd/src/app/views/user/UserCard.tsx
+++ b/FrontEnd/src/app/views/user/UserCard.tsx
@@ -7,9 +7,8 @@ import UserAvatar from "../common/user/UserAvatar";
const UserCard: React.FC<TimelinePageCardProps> = (props) => {
const { timeline } = props;
- const [dialog, setDialog] = React.useState<"member" | "property" | null>(
- null
- );
+ const [dialog, setDialog] =
+ React.useState<"member" | "property" | null>(null);
return (
<>