remove: 프로필 학년/등급 섹션 삭제

GradeCardCarousel, 현재등급/목표등급 배지, 관련 state/함수 모두 제거.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
reloop
2026-04-17 10:52:29 +09:00
parent 2c40372570
commit 90bccfbd66

View File

@@ -6,7 +6,6 @@ import { useRouter } from 'next/navigation';
import styled, { css } from 'styled-components';
import AppShell from '@/components/layout/AppShell';
import { Icon } from '@/components/ui/Icon';
import GradeCardCarousel from '@/components/ui/GradeCardCarousel';
import { Button, Card } from '@/components/ui/primitives';
import { useToast } from '@/components/ui/Toast';
import {
@@ -103,8 +102,6 @@ function ProfileBody() {
const [user, setUser] = useState<MeUser | null>(null);
const [nicknameDraft, setNicknameDraft] = useState('');
const [isEditingNickname, setIsEditingNickname] = useState(false);
const [currentGradeDraft, setCurrentGradeDraft] = useState(5);
const [targetGradeDraft, setTargetGradeDraft] = useState(3);
const [notifications, setNotifications] =
useState<NotificationPrefs>(DEFAULT_NOTIFICATIONS);
const [studyLogs, setStudyLogs] = useState<StudyLog[]>([]);
@@ -115,19 +112,11 @@ function ProfileBody() {
const userRef = useRef<MeUser | null>(null);
const avatarFileInputRef = useRef<HTMLInputElement | null>(null);
const currentGradeRef = useRef(5);
const targetGradeRef = useRef(3);
const gradeSaveTimerRef = useRef<number | null>(null);
const notificationsReadyRef = useRef(false);
useEffect(() => {
void loadProfile();
return () => {
if (gradeSaveTimerRef.current !== null) {
window.clearTimeout(gradeSaveTimerRef.current);
}
};
}, []);
useEffect(() => {
@@ -138,14 +127,6 @@ function ProfileBody() {
};
}, [avatarPreviewUrl]);
useEffect(() => {
currentGradeRef.current = currentGradeDraft;
}, [currentGradeDraft]);
useEffect(() => {
targetGradeRef.current = targetGradeDraft;
}, [targetGradeDraft]);
useEffect(() => {
if (typeof window === 'undefined') return;
@@ -188,9 +169,6 @@ function ProfileBody() {
userRef.current = nextUser;
setUser(nextUser);
setNicknameDraft(nextUser.nickname);
setCurrentGradeDraft(nextUser.currentGrade ?? 5);
setTargetGradeDraft(nextUser.targetGrade ?? 3);
setAvatarPreviewUrl(null);
setStudyLogs(logs);
@@ -213,15 +191,11 @@ function ProfileBody() {
userRef.current = nextUser;
setUser(nextUser);
setNicknameDraft(nextUser.nickname);
setCurrentGradeDraft(nextUser.currentGrade ?? currentGradeRef.current);
setTargetGradeDraft(nextUser.targetGrade ?? targetGradeRef.current);
showToast({ message: successMessage, variant: 'success' });
} catch {
const currentUser = userRef.current;
setNicknameDraft(currentUser?.nickname ?? '');
setCurrentGradeDraft(currentUser?.currentGrade ?? 5);
setTargetGradeDraft(currentUser?.targetGrade ?? 3);
showToast({ message: '저장에 실패했습니다', variant: 'danger' });
} finally {
setSavingKey((current) => (current === key ? null : current));
@@ -266,33 +240,6 @@ function ProfileBody() {
}
}
function queueGradeSave() {
if (!userRef.current) return;
const nextCurrent = currentGradeRef.current;
const nextTarget = targetGradeRef.current;
const prevCurrent = userRef.current.currentGrade ?? 5;
const prevTarget = userRef.current.targetGrade ?? 3;
if (nextCurrent === prevCurrent && nextTarget === prevTarget) {
return;
}
if (gradeSaveTimerRef.current !== null) {
window.clearTimeout(gradeSaveTimerRef.current);
}
gradeSaveTimerRef.current = window.setTimeout(() => {
void patchProfile(
{
currentGrade: currentGradeRef.current,
targetGrade: targetGradeRef.current,
},
'grades',
);
}, 400);
}
function handlePersonaSelect(value: Persona) {
if (!user || value === user.persona) return;
void patchProfile({ persona: value }, 'persona', '페르소나 변경됨 — 복습 스케줄을 새 설정에 맞게 재계산했어요');
@@ -546,39 +493,10 @@ function ProfileBody() {
<PlanBadge>{planLabel(user.subscriptionTier)}</PlanBadge>
</NameRow>
<Email>{user.email}</Email>
<BadgeRow>
<InfoBadge> {currentGradeDraft}</InfoBadge>
<InfoBadge> {targetGradeDraft}</InfoBadge>
</BadgeRow>
</AccountContent>
</AccountRow>
</CardSection>
<CardSection>
<SectionHeader>
<SectionTitle>/</SectionTitle>
</SectionHeader>
<SliderGroup>
<GradeCardCarousel
label="현재 등급"
value={currentGradeDraft}
helper="현재 체감 실력 기준"
onChange={(value) => {
setCurrentGradeDraft(value);
window.requestAnimationFrame(queueGradeSave);
}}
/>
<GradeCardCarousel
label="목표 등급"
value={targetGradeDraft}
helper="도달하고 싶은 다음 기준"
onChange={(value) => {
setTargetGradeDraft(value);
window.requestAnimationFrame(queueGradeSave);
}}
/>
</SliderGroup>
</CardSection>
</Grid>
) : null}
@@ -1075,25 +993,6 @@ const Email = styled.p`
color: ${theme.color.textMute};
`;
const BadgeRow = styled.div`
display: flex;
gap: 10px;
flex-wrap: wrap;
`;
const InfoBadge = styled.div`
padding: 10px 12px;
border-radius: 14px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid ${theme.color.borderSoftAlpha};
color: ${theme.color.textSub};
font-size: 13px;
`;
const SliderGroup = styled.div`
display: grid;
gap: 18px;
`;
const PersonaGrid = styled.div`
display: grid;