Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge to prod #127

Merged
merged 13 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading