From 907a9fc8a63814a2650ade15182326a404479d0a Mon Sep 17 00:00:00 2001 From: Minjun Kim Date: Thu, 7 Nov 2024 16:25:47 +0900 Subject: [PATCH 01/29] Update policyData.ts --- src/components/policy/policyData.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/policy/policyData.ts b/src/components/policy/policyData.ts index f0ab43db..a6a2d673 100644 --- a/src/components/policy/policyData.ts +++ b/src/components/policy/policyData.ts @@ -117,6 +117,7 @@ const data = { 1. "회원"의 게시물이 "정보통신망법" 및 "저작권법"등 관련법에 위반되는 내용을 포함하는 경우, 권리자는 관련법이 정한 절차에 따라 해당 게시물의 게시중단 및 삭제 등을 요청할 수 있으며, "회사"는 관련법에 따라 조치를 취하여야 합니다. 2. "회사"는 전항에 따른 권리자의 요청이 없는 경우라도 권리침해가 인정될 만한 사유가 있거나 기타 회사 정책 및 관련법에 위반되는 경우에는 관련법에 따라 해당 게시물에 대해 임시조치 등을 취할 수 있습니다. 3. 본 조에 따른 세부절차는 "정보통신망법" 및 "저작권법"이 규정한 범위 내에서 회사가 정한 게시중단요청서비스에 따릅니다. +4. "회사"는 [커뮤니티 가이드라인](https://chafgames.notion.site/137fd2be2cdc8046b0f1fb8c93ac26d1?pvs=74)에 따라 게시물의 게시중단 및 삭제처리를 할 수 있습니다. ## 제 10조 권리의 귀속 From 52e470b9b0177394e6e933a5fcdb2f9714c6c93a Mon Sep 17 00:00:00 2001 From: velopert Date: Mon, 18 Nov 2024 03:48:19 +0900 Subject: [PATCH 02/29] fix: adds job position --- src/components/post/JobPositions.tsx | 160 +++++++++++++++++++++++++++ src/containers/post/PostViewer.tsx | 44 +++++++- src/lib/graphql/ad.ts | 22 ++++ 3 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 src/components/post/JobPositions.tsx diff --git a/src/components/post/JobPositions.tsx b/src/components/post/JobPositions.tsx new file mode 100644 index 00000000..a0471e66 --- /dev/null +++ b/src/components/post/JobPositions.tsx @@ -0,0 +1,160 @@ +import { useQuery } from '@apollo/react-hooks'; +import React, { useEffect, useRef, useState } from 'react'; +import { JOB_POSITIONS, JobPosition } from '../../lib/graphql/ad'; +import styled from 'styled-components'; +import VelogResponsive from '../velog/VelogResponsive'; +import Typography from '../common/Typography'; +import { themedPalette } from '../../lib/styles/themes'; +import { ellipsis } from '../../lib/styles/utils'; +import media from '../../lib/styles/media'; +import gtag from '../../lib/gtag'; + +type Props = { + category: 'frontend' | 'backend' | 'mobile' | 'python' | 'node' | 'ai' | null; +}; + +function JobPositions({ category }: Props) { + const [isObserved, setIsObserved] = useState(false); + const { data } = useQuery<{ jobPositions: JobPosition[] }>(JOB_POSITIONS, { + variables: { + category: category ?? undefined, + }, + skip: !isObserved, + }); + + const ref = useRef(null); + const initializedRef = useRef(false); + + useEffect(() => { + const observer = new IntersectionObserver( + (entries) => { + entries.forEach((entry) => { + if (entry.isIntersecting && !initializedRef.current) { + setIsObserved(true); + } + }); + }, + { + rootMargin: '300px', + threshold: 0, + }, + ); + if (!ref.current) return; + observer.observe(ref.current); + return () => { + observer.disconnect(); + }; + }, []); + + const onClick = () => { + gtag('event', 'job_position_click'); + }; + + useEffect(() => { + if (!isObserved) { + return; + } + gtag('event', 'job_position_view'); + }, [isObserved]); + + if (!data?.jobPositions) + return ( + +
+
+ ); + + return ( + +
+ +

관련 채용 정보

+ + {data.jobPositions.map((jobPosition) => ( + + + + + + + + + + + {jobPosition.name} + + ))} + +
+
+ ); +} + +const Block = styled(VelogResponsive)` + ${media.small} { + h4 { + padding-left: 1rem; + padding-right: 1rem; + } + } +`; +const Container = styled.div` + display: flex; + gap: 1rem; + a { + display: block; + color: inherit; + &:hover { + text-decoration: none; + color: inherit; + } + } + ${media.small} { + padding-left: 0.5rem; + padding-right: 0.5rem; + gap: 0.5rem; + overflow-x: auto; + overflow-y: hidden; + padding-bottom: 1rem; + } +`; + +const Card = styled.div` + width: 25%; + ${media.small} { + flex-shrink: 0; + width: 27vw; + } +`; + +const Thumbnail = styled.img` + width: 100%; + aspect-ratio: 400 / 292; + object-fit: cover; + border-radius: 4px; +`; + +const Company = styled.div` + display: flex; + gap: 0.5rem; + img { + display: block; + width: 16px; + height: 16px; + } + font-size: 10px; + align-items: center; + color: ${themedPalette.text2}; + ${ellipsis}; + margin-bottom: 0.5rem; +`; + +const JobTitle = styled.a` + font-size: 12px; + font-weight: 600; + line-height: 1.25; +`; + +export default JobPositions; diff --git a/src/containers/post/PostViewer.tsx b/src/containers/post/PostViewer.tsx index 7ce37736..9b5d75e7 100644 --- a/src/containers/post/PostViewer.tsx +++ b/src/containers/post/PostViewer.tsx @@ -46,6 +46,7 @@ import gtag from '../../lib/gtag'; import FollowButton from '../../components/common/FollowButton'; import { BANNER_ADS } from '../../lib/graphql/ad'; import PostBanner from '../../components/post/PostBanner'; +import JobPositions from '../../components/post/JobPositions'; const UserProfileWrapper = styled(VelogResponsive)` margin-top: 16rem; @@ -75,6 +76,7 @@ const PostViewer: React.FC = ({ }) => { const setShowFooter = useSetShowFooter(); const [showRecommends, setShowRecommends] = useState(false); + useEffect(() => { window.scrollTo(0, 0); }, [username, urlSlug]); @@ -251,6 +253,40 @@ const PostViewer: React.FC = ({ } }, [customAd, shouldShowBanner, shouldShowFooterBanner]); + const category = useMemo(() => { + const frontendKeywords = ['프런트엔드', '리액트', 'vue', 'react', 'next']; + const backendKeywords = ['백엔드', '서버', '데이터베이스', 'db']; + const aiKeywords = ['인공지능', '머신러닝', '딥러닝', 'ai']; + const mobileKeywords = [ + '모바일', + '안드로이드', + 'ios', + 'react native', + '플러터', + 'flutter', + ]; + const pythonKeywords = ['파이썬', 'python']; + const nodeKeywords = ['노드', 'node', 'express', 'koa', 'nest']; + + if (!data?.post) return null; + const { post } = data; + const merged = post.title + .concat(post.tags.join(',')) + .concat(post.body) + .toLowerCase(); + if (frontendKeywords.some((keyword) => merged.includes(keyword))) + return 'frontend'; + if (backendKeywords.some((keyword) => merged.includes(keyword))) + return 'backend'; + if (aiKeywords.some((keyword) => merged.includes(keyword))) return 'ai'; + if (mobileKeywords.some((keyword) => merged.includes(keyword))) + return 'mobile'; + if (pythonKeywords.some((keyword) => merged.includes(keyword))) + return 'python'; + if (nodeKeywords.some((keyword) => merged.includes(keyword))) return 'node'; + return null; + }, [data]); + const onRemove = async () => { if (!data || !data.post) return; setIsRemoveLoading(true); @@ -486,10 +522,10 @@ const PostViewer: React.FC = ({ /> - {shouldShowBanner && isContentLongEnough ? ( + {shouldShowBanner && isContentLongEnough && customAd ? ( ) : null} - {shouldShowFooterBanner ? ( + {shouldShowFooterBanner && customAd ? ( ) : null} = ({ postId={post.id} ownPost={post.user.id === userId} /> + {(shouldShowBanner || shouldShowFooterBanner) && !customAd ? ( + + ) : null} + {showRecommends ? ( ) : null} diff --git a/src/lib/graphql/ad.ts b/src/lib/graphql/ad.ts index 483be812..63c39656 100644 --- a/src/lib/graphql/ad.ts +++ b/src/lib/graphql/ad.ts @@ -8,6 +8,15 @@ export type Ad = { url: string; }; +export type JobPosition = { + id: string; + name: string; + companyName: string; + companyLogo: string; + thumbnail: string; + url: string; +}; + export const BANNER_ADS = gql` query BannerAds($writerUsername: String!) { bannerAds(writer_username: $writerUsername) { @@ -19,3 +28,16 @@ export const BANNER_ADS = gql` } } `; + +export const JOB_POSITIONS = gql` + query JobPositions($category: String) { + jobPositions(category: $category) { + id + name + companyName + companyLogo + thumbnail + url + } + } +`; From f8bda2850c60e3e375eb35ada620aca51d0c6c57 Mon Sep 17 00:00:00 2001 From: Kwonkyu Date: Fri, 27 Dec 2024 22:17:25 +0900 Subject: [PATCH 03/29] =?UTF-8?q?=ED=83=9C=EA=B7=B8=EA=B0=80=20=EB=B9=84?= =?UTF-8?q?=EC=96=B4=EC=9E=88=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C=EB=90=98=EC=A7=80=20=EC=95=8A=EB=8D=98=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=EB=A5=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/write/TagInput.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/write/TagInput.tsx b/src/components/write/TagInput.tsx index 0c470ed3..a4b11b69 100644 --- a/src/components/write/TagInput.tsx +++ b/src/components/write/TagInput.tsx @@ -28,7 +28,6 @@ const TagInput: React.FC = ({ onChange, tags: initialTags }) => { const ignore = useRef(false); useEffect(() => { - if (tags.length === 0) return; onChange(tags); }, [tags, onChange]); From 588a328437cd9061068cdb1f1dcba4fccc455c33 Mon Sep 17 00:00:00 2001 From: carrick Date: Mon, 6 Jan 2025 08:34:26 +0900 Subject: [PATCH 04/29] chore: fix git ignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b91ca42f..0516f767 100755 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,7 @@ jspm_packages # Serverless directories .serverless .webpack + +# ignore setting +.idea +.vscode From a600503429b9c69772386b5736b1af47b1ec68bb Mon Sep 17 00:00:00 2001 From: velopert Date: Wed, 5 Feb 2025 18:56:48 +0900 Subject: [PATCH 05/29] fix: job positions logic --- src/components/post/JobPositions.tsx | 34 +++++++++++++++++--------- src/containers/post/PostViewer.tsx | 36 +++++++++++++++++++++------- src/lib/api/jobs.ts | 21 ++++++++++++++++ 3 files changed, 71 insertions(+), 20 deletions(-) create mode 100644 src/lib/api/jobs.ts diff --git a/src/components/post/JobPositions.tsx b/src/components/post/JobPositions.tsx index a0471e66..b6869448 100644 --- a/src/components/post/JobPositions.tsx +++ b/src/components/post/JobPositions.tsx @@ -8,6 +8,7 @@ import { themedPalette } from '../../lib/styles/themes'; import { ellipsis } from '../../lib/styles/utils'; import media from '../../lib/styles/media'; import gtag from '../../lib/gtag'; +import { getJobs, Job } from '../../lib/api/jobs'; type Props = { category: 'frontend' | 'backend' | 'mobile' | 'python' | 'node' | 'ai' | null; @@ -15,16 +16,19 @@ type Props = { function JobPositions({ category }: Props) { const [isObserved, setIsObserved] = useState(false); - const { data } = useQuery<{ jobPositions: JobPosition[] }>(JOB_POSITIONS, { - variables: { - category: category ?? undefined, - }, - skip: !isObserved, - }); + const [data, setData] = useState([]); const ref = useRef(null); const initializedRef = useRef(false); + useEffect(() => { + getJobs(category || 'general').then((jobs) => { + const shuffled = jobs.sort(() => Math.random() - 0.5); + const sliced = shuffled.slice(0, 3); + setData(sliced); + }); + }, [category]); + useEffect(() => { const observer = new IntersectionObserver( (entries) => { @@ -57,7 +61,7 @@ function JobPositions({ category }: Props) { gtag('event', 'job_position_view'); }, [isObserved]); - if (!data?.jobPositions) + if (!data) return (
@@ -70,7 +74,7 @@ function JobPositions({ category }: Props) {

관련 채용 정보

- {data.jobPositions.map((jobPosition) => ( + {data.map((jobPosition) => ( @@ -84,6 +88,7 @@ function JobPositions({ category }: Props) { {jobPosition.name} + {jobPosition.summary} ))} @@ -122,10 +127,10 @@ const Container = styled.div` `; const Card = styled.div` - width: 25%; + width: 33.33%; ${media.small} { flex-shrink: 0; - width: 27vw; + width: 60vw; } `; @@ -152,9 +157,16 @@ const Company = styled.div` `; const JobTitle = styled.a` - font-size: 12px; + font-size: 14px; font-weight: 600; line-height: 1.25; `; +const JobDescription = styled.div` + margin-top: 8px; + color: ${themedPalette.text2}; + font-size: 12px; + line-height: 1.5; +`; + export default JobPositions; diff --git a/src/containers/post/PostViewer.tsx b/src/containers/post/PostViewer.tsx index 9b5d75e7..34a1e936 100644 --- a/src/containers/post/PostViewer.tsx +++ b/src/containers/post/PostViewer.tsx @@ -223,7 +223,7 @@ const PostViewer: React.FC = ({ const isOwnPost = post.user.id === userId; const isVeryOld = Date.now() - new Date(post.released_at).getTime() > - 1000 * 60 * 60 * 24 * 30; + 1000 * 60 * 60 * 24 * 10; if (isOwnPost) return false; if (!isVeryOld) return false; @@ -254,16 +254,24 @@ const PostViewer: React.FC = ({ }, [customAd, shouldShowBanner, shouldShowFooterBanner]); const category = useMemo(() => { - const frontendKeywords = ['프런트엔드', '리액트', 'vue', 'react', 'next']; + const frontendKeywords = [ + '프런트엔드', + '리액트', + 'vue', + 'react', + 'next', + '프론트엔드', + ]; const backendKeywords = ['백엔드', '서버', '데이터베이스', 'db']; - const aiKeywords = ['인공지능', '머신러닝', '딥러닝', 'ai']; + const aiKeywords = ['인공지능', '머신러닝', '딥러닝', 'nlp', 'llm']; const mobileKeywords = [ - '모바일', '안드로이드', 'ios', 'react native', '플러터', 'flutter', + 'swift', + 'xcode', ]; const pythonKeywords = ['파이썬', 'python']; const nodeKeywords = ['노드', 'node', 'express', 'koa', 'nest']; @@ -274,15 +282,25 @@ const PostViewer: React.FC = ({ .concat(post.tags.join(',')) .concat(post.body) .toLowerCase(); + if ( + aiKeywords.some((keyword) => { + const value = merged.includes(keyword); + if (value) { + console.log(merged); + console.log(keyword); + } + return value; + }) + ) + return 'ai'; if (frontendKeywords.some((keyword) => merged.includes(keyword))) return 'frontend'; - if (backendKeywords.some((keyword) => merged.includes(keyword))) - return 'backend'; - if (aiKeywords.some((keyword) => merged.includes(keyword))) return 'ai'; if (mobileKeywords.some((keyword) => merged.includes(keyword))) return 'mobile'; if (pythonKeywords.some((keyword) => merged.includes(keyword))) return 'python'; + if (backendKeywords.some((keyword) => merged.includes(keyword))) + return 'backend'; if (nodeKeywords.some((keyword) => merged.includes(keyword))) return 'node'; return null; }, [data]); @@ -522,10 +540,10 @@ const PostViewer: React.FC = ({ /> - {shouldShowBanner && isContentLongEnough && customAd ? ( + {shouldShowBanner && isContentLongEnough ? ( ) : null} - {shouldShowFooterBanner && customAd ? ( + {shouldShowFooterBanner ? ( ) : null} (`/jobs/${category}`); + return response.data; +} + +export type Job = { + id: number; + name: string; + companyName: string; + companyLogo: string; + thumbnail: string; + url: string; + jobId: number; + summary: string; +}; From aa046291a0fb7aebf6f3c07fee61372008cb9c21 Mon Sep 17 00:00:00 2001 From: velopert Date: Wed, 5 Feb 2025 19:11:59 +0900 Subject: [PATCH 06/29] fix: link inside description --- src/components/post/JobPositions.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/post/JobPositions.tsx b/src/components/post/JobPositions.tsx index b6869448..d9e88808 100644 --- a/src/components/post/JobPositions.tsx +++ b/src/components/post/JobPositions.tsx @@ -88,7 +88,9 @@ function JobPositions({ category }: Props) { {jobPosition.name} - {jobPosition.summary} + + {jobPosition.summary} + ))} From bf48305f32cdc43f51f80a91e801fef2ef1f5d8f Mon Sep 17 00:00:00 2001 From: velopert Date: Thu, 8 May 2025 11:10:31 +0900 Subject: [PATCH 07/29] fix: update identifier --- src/server/Html.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/Html.tsx b/src/server/Html.tsx index 5fa9641b..52b25f69 100644 --- a/src/server/Html.tsx +++ b/src/server/Html.tsx @@ -74,7 +74,7 @@ function Html({ > */}