Skip to content

Commit

Permalink
Merge pull request #189 from JohnsonMao/feature/signin-page-success-m…
Browse files Browse the repository at this point in the history
…odal

build: add ts dependencies and configure babel/eslint
  • Loading branch information
JohnsonMao authored Dec 21, 2024
2 parents c3ab188 + ca7ed8d commit 9e2067e
Show file tree
Hide file tree
Showing 93 changed files with 557 additions and 939 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"importSource": "@emotion/react"
}
}
]
],
"@babel/preset-typescript"
],
"plugins": [
[
Expand Down
33 changes: 23 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: 'module',
},
plugins: ['react', 'import', 'react-hooks'],
extends: ['airbnb'],
plugins: ['react', 'import', 'react-hooks', '@typescript-eslint'],
extends: ['airbnb', 'plugin:@typescript-eslint/recommended'],
env: {
browser: true,
es2021: true,
Expand All @@ -21,21 +22,32 @@ module.exports = {
map: [['@', '.']],
},
node: {
extensions: ['.js', '.jsx', '.ts', '.tsx']
extensions: ['.js', '.jsx', '.ts', '.tsx'],
},
},
},
rules: {
"import/no-extraneous-dependencies": ["error", { devDependencies: ["./*.js"] }],
'import/extensions': ['error', 'ignorePackages', {
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
}],
'import/no-extraneous-dependencies': [
'error',
{ devDependencies: ['./*.js'] },
],
'import/extensions': [
'error',
'ignorePackages',
{
js: 'never',
jsx: 'never',
ts: 'never',
tsx: 'never',
},
],
'react/no-unescaped-entities': 'off',
'@next/next/no-page-custom-font': 'off',
'react/prop-types': [0],
'react/jsx-filename-extension': [
1,
{ extensions: ['.js', '.jsx', '.ts', '.tsx'] },
],
'react/jsx-props-no-spreading': [0],
'arrow-body-style': 0,
'no-console': 0,
Expand Down Expand Up @@ -64,6 +76,7 @@ module.exports = {
'react/function-component-definition': 0,
'react/jsx-no-useless-fragment': 0,
'react/no-unknown-property': 0,
'react/require-default-props': 0,
'no-unsafe-optional-chaining': 0,
'react/no-invalid-html-attribute': 0,
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/push-change-to-discord-webhook-url.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Push Change to Discord Webhook URL
on:
push:
branches:
- main
- dev

# Allow manual trigger
workflow_dispatch:
Expand Down
2 changes: 1 addition & 1 deletion components/About/AboutTeam/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const AboutTeam = () => {
flexDirection: 'row',
}}
>
{Members.map(({ id, name, image }) => (
{Members.map(({ id, name }) => (
<Tooltip key={id} title={name}>
<Avatar
sx={{ margin: '4px', width: 50, height: 50 }}
Expand Down
3 changes: 1 addition & 2 deletions components/About/AwardInfo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const LinkWrapper = styled.a`
color: black;
Expand Down
3 changes: 1 addition & 2 deletions components/About/ContactUs/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const ContactUsWrapper = styled.address`
margin: 20px 0;
Expand Down
7 changes: 1 addition & 6 deletions components/About/Cooperate/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-disable jsx-a11y/alt-text */
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';

const LineWrapper = styled(Typography)`
margin: 5px 0;
`;
import { Typography } from '@mui/material';

const SectionWrapper = styled.section`
margin: 20px 0;
Expand Down
3 changes: 1 addition & 2 deletions components/About/NeedYou/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar, Button } from '@mui/material';
import { Typography, Stack, Button } from '@mui/material';

const LinkWrapper = styled.a`
color: black;
Expand Down
3 changes: 1 addition & 2 deletions components/About/RealizeMore/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const LinkWrapper = styled.a`
color: black;
Expand Down
3 changes: 1 addition & 2 deletions components/About/RelatedReport/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const LinkWrapper = styled.a`
color: black;
Expand Down
3 changes: 1 addition & 2 deletions components/About/TechStack/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable jsx-a11y/alt-text */
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const LineWrapper = styled(Typography)`
margin: 5px 0;
Expand Down
3 changes: 1 addition & 2 deletions components/About/Thanks/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import { Typography, Stack } from '@mui/material';

const LineWrapper = styled(Typography)`
margin: 5px 0;
Expand Down
3 changes: 1 addition & 2 deletions components/About/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
import { Box, Paper, Typography, Stack, Avatar } from '@mui/material';
import Tooltip from '@mui/material/Tooltip';
import { Paper } from '@mui/material';
import AboutUs from './AboutUs';
import RealizeMore from './RealizeMore';
import RelatedReport from './RelatedReport';
Expand Down
13 changes: 6 additions & 7 deletions components/Activities/Ncku-bike-festival/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable jsx-a11y/no-static-element-interactions */
import React, { useMemo, useState } from 'react';
import React, { useState } from 'react';
import styled from '@emotion/styled';
// import { css } from "@emotion/react";
import { Box, Paper, Typography, Button } from '@mui/material';
import { Stage, Layer, Rect, Text, Circle, Line, Image } from 'react-konva';
import { Stage, Layer, Text, Image } from 'react-konva';
import useImage from 'use-image';

const ResourceWrapper = styled.section`
Expand All @@ -31,18 +30,18 @@ const ResourceWrapper = styled.section`

const NckuBikeFestival = () => {
const stageRef = React.useRef(null);
const [mainState, setMainState] = useState('initial'); // initial, search, gallery, uploaded
const [imageUploaded, setImageUploaded] = useState(0);
const [, setMainState] = useState('initial'); // initial, search, gallery, uploaded
const [, setImageUploaded] = useState(0);
const [selectedFile, setSelectedFile] = useState(null);
const [img] = useImage(selectedFile, 'Anonymous');
const [newImage] = useImage(stageRef?.current?.toDataURL(), 'Anonymous');
useImage(stageRef?.current?.toDataURL(), 'Anonymous');

const handleUploadClick = (event) => {
const file = event.target.files[0];
const reader = new FileReader();
const url = reader.readAsDataURL(file);

reader.onloadend = function (e) {
reader.onloadend = () => {
setSelectedFile([reader.result]);
};
console.log(url);
Expand Down
3 changes: 1 addition & 2 deletions components/ContributeResource/ActivitiesResource/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import styled from '@emotion/styled';
import { Box, Paper, Typography } from '@mui/material';
import { Box, Typography } from '@mui/material';

const ActivitiesResource = () => {
return (
Expand Down
3 changes: 1 addition & 2 deletions components/ContributeResource/LocationResource/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import styled from '@emotion/styled';
import { Box, Paper, Typography } from '@mui/material';
import { Box, Typography } from '@mui/material';

const LearningResource = () => {
return (
Expand Down
1 change: 0 additions & 1 deletion components/ContributeResource/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import styled from '@emotion/styled';
import { Paper, Box, Typography } from '@mui/material';
import LearningResource from './LearningResource';
import ActivitiesResource from './ActivitiesResource';
import LocationResource from './LocationResource';

const ResourceWrapper = styled.section`
padding-top: 40px;
Expand Down
2 changes: 1 addition & 1 deletion components/Group/Form/Fields/DateRadio.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import dayjs from 'dayjs';
import { useEffect, useState } from 'react';
import { useState } from 'react';
import Box from '@mui/material/Box';
import FormControlLabel from '@mui/material/FormControlLabel';
import Checkbox from '@mui/material/Checkbox';
Expand Down
7 changes: 0 additions & 7 deletions components/Group/detail/OrganizerCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ const StyledTags = styled.div`
}
`;

const StyledTime = styled.time`
display: flex;
justify-content: flex-end;
font-size: 12px;
color: #92989a;
`;

function OrganizerCard({ data = {}, isLoading }) {
const educationStage =
EDUCATION_STEP.find(({ key }) => key === data?.user?.educationStage)
Expand Down
1 change: 0 additions & 1 deletion components/Home/APPBanner/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React, { useState } from 'react';
import styled from '@emotion/styled';
import Box from '@mui/material/Box';
import { Typography, Button } from '@mui/material';
Expand Down
41 changes: 2 additions & 39 deletions components/Home/About/Tags/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useMemo } from 'react';
import React, { useMemo } from 'react';
import styled from '@emotion/styled';
import { useRouter } from 'next/router';
import Chip from '@mui/material/Chip';
Expand All @@ -10,45 +10,8 @@ const TagsWrapper = styled.ul`
flex-wrap: wrap;
`;

// const TagItemWrapper = styled.li`
// color: black;
// border-radius: 15px;
// padding: 2px 10px;
// margin: 0 5px;
// white-space: nowrap;
// cursor: pointer;
// ${({ color }) => css`
// background-color: ${COLOR_TABLE[color ?? "default"]};
// `}
// `;

const Tags = ({ tags = [], type }) => {
const { query, push } = useRouter();
const linkTagsHandler = useCallback(
(newQuery) => {
// 複製一份,避免影響到使用體驗
const clonedQuery = { ...query };
delete clonedQuery.title;
if (clonedQuery[type]) {
push({
pathname: '/search',
query: {
...clonedQuery,
[type]: [clonedQuery[type].split(','), newQuery].join(','),
},
});
} else {
push({
pathname: '/search',
query: {
...clonedQuery,
[type]: newQuery,
},
});
}
},
[push, query, type],
);
const { query } = useRouter();

const linkList = useMemo(() => {
return tags.map((newQuery) => {
Expand Down
5 changes: 1 addition & 4 deletions components/Home/About/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import React from 'react';
import styled from '@emotion/styled';
import Box from '@mui/material/Box';
import { Typography, Button } from '@mui/material';
import { FacebookRounded } from '@mui/icons-material';
import Chip from '@mui/material/Chip';
import { Box, Chip, Typography } from '@mui/material';
import { useRouter } from 'next/router';
import { COLOR_TABLE } from '../../../constants/notion';
import { CATEGORIES } from '../../../constants/category';
Expand Down
1 change: 0 additions & 1 deletion components/Home/Banner/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { useCallback } from 'react';
import styled from '@emotion/styled';
import { Box, Button, Typography } from '@mui/material';
import Typed from 'react-typed';
import SearchField from '../SearchField';
import BannerVideo from '../BannerVideo';
import Title from './Title';
Expand Down
26 changes: 2 additions & 24 deletions components/Home/FacebookPosts/CardList/Card/index.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import styled from '@emotion/styled';
import { css } from '@emotion/react';
import { useRouter } from 'next/router';
import { Box, Tooltip, Typography } from '@mui/material';
import { Box, Tooltip } from '@mui/material';
import dayjs from 'dayjs';
import { slideInUp } from '../../../../../shared/styles/animation';

const CardWrapper = styled.li`
position: relative;
Expand Down Expand Up @@ -41,26 +38,7 @@ const ContentWrapper = styled.p`
font-size: 12px;
`;

const BackgroundWrapper = styled.div`
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
border-radius: 20px;
z-index: -1;
${({ image }) => css`
background-image: ${`url(${image})`};
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
filter: brightness(50%);
`}
`;

const Card = ({ id, message = '', date, title, link, type }) => {
const router = useRouter();
const Card = ({ id, message = '', date }) => {
return (
<Tooltip title={message.slice(0, 150)}>
<CardWrapper
Expand Down
Loading

0 comments on commit 9e2067e

Please sign in to comment.