Skip to content

Commit

Permalink
Merge pull request #127 from daodaoedu/dev
Browse files Browse the repository at this point in the history
Merge to prod
  • Loading branch information
JohnsonMao authored Nov 14, 2024
2 parents cfdc323 + 20c700b commit 7dc19c1
Show file tree
Hide file tree
Showing 29 changed files with 2,940 additions and 1,988 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
sourceType: 'module',
},
plugins: ['react', 'import', 'react-hooks'],
extends: ['plugin:prettier/recommended', 'airbnb'],
extends: ['airbnb'],
env: {
browser: true,
es2021: true,
Expand All @@ -23,6 +23,7 @@ module.exports = {
},
},
rules: {
"import/no-extraneous-dependencies": ["error", { devDependencies: ["./*.js"] }],
'react/no-unescaped-entities': 'off',
'@next/next/no-page-custom-font': 'off',
'react/prop-types': [0],
Expand Down
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.14.0
18.18.0
6 changes: 0 additions & 6 deletions .prettierrc.json

This file was deleted.

10 changes: 0 additions & 10 deletions .vscode/settings.json

This file was deleted.

1 change: 0 additions & 1 deletion components/ContributeResource/LearningResource/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Box, Typography, Button } from '@mui/material';
import window from 'global/window';

const LearningResource = () => {
return (
Expand Down
6 changes: 4 additions & 2 deletions components/Group/Form/Fields/Upload.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,14 @@ export default function Upload({ name, value, control }) {
useEffect(() => {
if (typeof value === 'string' && value) {
setPreview(value);
isLoading.current = false;
} else if (!isLoading.current && !value) {
isLoading.current = true;
fetch('https://picsum.photos/436/244')
.then((res) => res.blob())
.then(handleFile)
.then(() => {
.then((blob) => {
if (!isLoading.current) return;
handleFile(blob);
isLoading.current = false;
});
}
Expand Down
16 changes: 5 additions & 11 deletions components/Group/Form/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react';
import { useState } from 'react';
import Link from 'next/link';
import styled from '@emotion/styled';
import Box from '@mui/material/Box';
Expand Down Expand Up @@ -45,20 +45,14 @@ export default function GroupForm({
values,
errors,
isDirty,
setValues,
handleSubmit,
} = useGroupForm();
} = useGroupForm({
...defaultValues,
originPhotoURL: defaultValues?.photoURL,
});
const [isChecked, setIsChecked] = useState(false);
const isCreateMode = mode === 'create';

useEffect(() => {
if (!defaultValues) return;
setValues({
...defaultValues,
originPhotoURL: defaultValues.photoURL,
});
}, [defaultValues]);

const desc = (
<StyledDesc>
請確認揪團未涉及不雅內容並符合本網站{' '}
Expand Down
8 changes: 4 additions & 4 deletions components/Group/Form/useGroupForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const categoriesOptions = CATEGORIES;
export const areasOptions = AREAS.filter((area) => area.label !== '線上');
export const eduOptions = _eduOptions;

const DEFAULT_VALUES = {
const INITIAL_VALUES = {
userId: '',
title: '',
file: null,
Expand Down Expand Up @@ -79,12 +79,13 @@ const rules = {
isGrouping: z.boolean(),
};

export default function useGroupForm() {
export default function useGroupForm(defaultValue) {
const [isDirty, setIsDirty] = useState(false);
const me = useSelector((state) => state.user);
const notLogin = !me?._id;
const [values, setValues] = useState({
...DEFAULT_VALUES,
...INITIAL_VALUES,
...defaultValue,
userId: me?._id,
});
const [errors, setErrors] = useState({});
Expand Down Expand Up @@ -194,7 +195,6 @@ export default function useGroupForm() {
errors,
values,
isDirty,
setValues,
handleSubmit,
};
}
60 changes: 0 additions & 60 deletions components/MyIsland/ResourceCard/Tags/index.jsx

This file was deleted.

94 changes: 0 additions & 94 deletions components/MyIsland/ResourceCard/index.jsx

This file was deleted.

Loading

0 comments on commit 7dc19c1

Please sign in to comment.