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

ver 1.0.3 #111

Merged
merged 14 commits into from
May 2, 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
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1, width=device-width"
name="viewport"
/>
<link
rel="apple-touch-icon"
sizes="152x152"
href="/icon-152.png"
type="image/png"
/>
</head>
<body>
<div id="root"></div>
Expand Down
16,979 changes: 11,297 additions & 5,682 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"prettier": "^3.0.3",
"puppeteer": "^22.3.0",
"typescript": "^5.3.3",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vite-plugin-pwa": "^0.19.5"
}
}
Binary file added public/icon-152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/components/community/CommunityCardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const CommunityCardList = () => {

const generateCategoryList = () => [
'전체',
'자유게시판',
'공지사항',
'자유게시판',
'질문/답변',
'팁/정보',
'거래게시판',
Expand Down Expand Up @@ -160,9 +160,9 @@ const CommunityCardList = () => {
/>
</div>
<div className={styles.buttonCircle}>
<Link to={'/community/add'}>
<ButtonCircle />
</Link>
<Link to={'/community/add'}>
<ButtonCircle />
</Link>
</div>
</div>
);
Expand Down
6 changes: 6 additions & 0 deletions src/components/community/CommunityEditTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ const CommunityEditTextEditor = () => {
if (!user?.uid) {
alert('로그인이 필요합니다.');
return;
} else if (!editorRef) {
alert('게시글을 저장하려면 내용을 채워주세요');
return;
} else if (!title) {
alert('게시글을 저장하려면 제목을 채워주세요.');
return;
}

try {
Expand Down
5 changes: 4 additions & 1 deletion src/components/community/CommunityHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { useState } from 'react';
// 사용되지 않는 컴포넌트?

/* import { useState } from 'react';
import styles from './CommunityHeader.module.scss';

const CommunityHeader = () => {
Expand Down Expand Up @@ -38,3 +40,4 @@ const CommunityHeader = () => {
};

export default CommunityHeader;
*/
21 changes: 19 additions & 2 deletions src/components/community/CommunityTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,25 @@ import { useNavigate } from 'react-router-dom';
import useUserStore from '@/store/useUsersStore';
import styles from './CommunityTextEditor.module.scss';
import { addCommunity } from '@/lib/firebaseQueryCommunity';
import { ADMINS } from '@/lib/constants';

const CommunityTextEditor = () => {
const { user } = useUserStore();
const navigate = useNavigate();
const [loading, setLoading] = useState(false);
const [editorRef, setEditorRef] = useState('');
const [category, setCategory] = useState('자유게시판');
const [title, setTitle] = useState('제목을 작성해주세요.');
const [title, setTitle] = useState('');

const isAdmin = ADMINS.includes(user?.uid);

console.log(isAdmin);

const handleChange = (value: string) => {
if (!isAdmin && value === '공지사항') {
alert('관리자만 선택 가능합니다.');
return;
}
setCategory(value);
};

Expand All @@ -32,6 +41,12 @@ const CommunityTextEditor = () => {
if (!user?.uid) {
alert('로그인이 필요합니다.');
return;
} else if (!editorRef) {
alert('게시글을 저장하려면 내용을 채워주세요.');
return;
} else if (!title) {
alert('게시글을 저장하려면 제목을 채워주세요.');
return;
}

try {
Expand Down Expand Up @@ -74,7 +89,8 @@ const CommunityTextEditor = () => {
<div className={styles.inputTitle}>카테고리</div>
<Select
className={styles.inputSelect}
defaultValue="자유게시판"
defaultValue={category}
value={category}
style={{ width: 130 }}
onChange={handleChange}
options={[
Expand All @@ -94,6 +110,7 @@ const CommunityTextEditor = () => {
count={{ show: true, max: 50 }}
value={title}
onChange={handleChangeTitle}
placeholder="제목을 작성해주세요."
/>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/community/CommunityTextViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const CommunityTextViewer = ({ data }: any) => {
<div>
{content && (
<>
<div dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(content)}}
<div
dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }}
style={{
marginTop: '30px',
overflow: 'hidden',
whiteSpace: 'pre-wrap',
}}
/>
Expand Down
2 changes: 0 additions & 2 deletions src/components/dex/PokemonDexElementLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ const PokemonDexElementLayout = ({
return data.id.toString() === id ? styles.highlighted : '';
};

console.log(data.id.toString() === id);

return (
<motion.li
whileHover={{
Expand Down
2 changes: 1 addition & 1 deletion src/components/plate/PlateHideButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PlateHideButton = ({ isOpen, setIsOpen }: PlateHideButtonProp) => {
>
<IoChevronUp />
</motion.div>
<span className={styles.mobile_button}>속성 선택</span>
<span className={styles.mobile_button}>타입 선택</span>
</button>
);
};
Expand Down
6 changes: 6 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,9 @@ export const FORMDATE = (date: string) => {
// ) => (2 * baseStat + talentStat + effortStat / 4 + 100) * (level / 100) + 10,
// ATTACK: () => {},
// };

export const ADMINS = [
import.meta.env.VITE_ADMIN_UID_1,
import.meta.env.VITE_ADMIN_UID_2,
import.meta.env.VITE_ADMIN_UID_3,
];
24 changes: 23 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import prerender from '@prerenderer/rollup-plugin';
import { VitePWA } from 'vite-plugin-pwa';

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -18,7 +19,7 @@ export default defineConfig({
},
rendererOptions: {
maxConcurrentRoutes: 1,
renderAfterTime: 10000,
renderAfterTime: 15000,
},
postProcess(renderedRoute) {
renderedRoute.html = renderedRoute.html
Expand All @@ -29,6 +30,27 @@ export default defineConfig({
);
},
}),
VitePWA({
registerType: 'autoUpdate',
devOptions: {
enabled: true,
},
manifest: {
icons: [
{
src: '/icon-192.png',
type: 'image/png',
sizes: '192x192',
purpose: 'any maskable',
},
{
src: '/icon-512.png',
type: 'image/png',
sizes: '512x512',
},
],
},
}),
],

resolve: {
Expand Down
Loading