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

[# 139] 사용자 정보 등록 페이지에서 위치 등록시 레이아웃 깨지던 문제 해결 #140

Merged
merged 2 commits into from
Aug 29, 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
178 changes: 88 additions & 90 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,96 +17,94 @@ import ErrorPage from './pages/ErrorPage';

function App() {
return (
<div>
<BrowserRouter>
<Routes>
<Route
path="/"
element={
<PrivateRoute>
<Main />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/add'}
element={
<PrivateRoute>
<AddPlantPage />
</PrivateRoute>
}
/>
<Route
path="my-plant"
element={
<PrivateRoute>
<MyPlant />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/:plantId'}
element={
<PrivateRoute>
<MyPlantDetail />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/edit/:myPlantId'}
element={
<PrivateRoute>
<MyPlantEdit />
</PrivateRoute>
}
/>
<Route
path="/guide/:id"
element={
<PrivateRoute>
<GuideDetails />
</PrivateRoute>
}
/>
<Route
path="/guide"
element={
<PrivateRoute>
<Guide />
</PrivateRoute>
}
/>
<Route path="/login" element={<LoginPage />} />
<Route path={'/redirect'} element={<LoginRedirectPage />} />
<Route path={'/login/register'} element={<RegisterPage />} />
<Route
path="/profile"
element={
<PrivateRoute>
<Profile />
</PrivateRoute>
}
/>
<Route
path="/profile/edit"
element={
<PrivateRoute>
<ModifyNickname />
</PrivateRoute>
}
/>
<Route
path={'/profile/notification'}
element={
<PrivateRoute>
<AlimDetail />
</PrivateRoute>
}
/>
<Route path="/*" element={<ErrorPage />} />
</Routes>
</BrowserRouter>
</div>
<BrowserRouter>
<Routes>
<Route
path="/"
element={
<PrivateRoute>
<Main />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/add'}
element={
<PrivateRoute>
<AddPlantPage />
</PrivateRoute>
}
/>
<Route
path="my-plant"
element={
<PrivateRoute>
<MyPlant />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/:plantId'}
element={
<PrivateRoute>
<MyPlantDetail />
</PrivateRoute>
}
/>
<Route
path={'/my-plant/edit/:myPlantId'}
element={
<PrivateRoute>
<MyPlantEdit />
</PrivateRoute>
}
/>
<Route
path="/guide/:id"
element={
<PrivateRoute>
<GuideDetails />
</PrivateRoute>
}
/>
<Route
path="/guide"
element={
<PrivateRoute>
<Guide />
</PrivateRoute>
}
/>
<Route path="/login" element={<LoginPage />} />
<Route path={'/redirect'} element={<LoginRedirectPage />} />
<Route path={'/login/register'} element={<RegisterPage />} />
<Route
path="/profile"
element={
<PrivateRoute>
<Profile />
</PrivateRoute>
}
/>
<Route
path="/profile/edit"
element={
<PrivateRoute>
<ModifyNickname />
</PrivateRoute>
}
/>
<Route
path={'/profile/notification'}
element={
<PrivateRoute>
<AlimDetail />
</PrivateRoute>
}
/>
<Route path="/*" element={<ErrorPage />} />
</Routes>
</BrowserRouter>
);
}

Expand Down
4 changes: 4 additions & 0 deletions src/apis/user/getRegions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { baseAxios } from '@/libs/baseAxios.ts';
import { regions } from '@/mocks/mockDatas/regions.ts';

export const getRegions = async (query: string) => {
if (query === '') {
return [];
}

const response = await baseAxios<typeof regions>(`/region?name=${query}`);

return response.data;
Expand Down
2 changes: 1 addition & 1 deletion src/components/register/RegionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const RegionList = ({ onSelectLocation, search }: RegionListProps) => {
}, [search, debouncedUpdateSearch]);

return (
<ul>
<ul className={'h-full overflow-auto hide-scrollbar'}>
{locationList.map((location) => (
<li
className={'py-4 text-regular-body text-Gray800 font-medium'}
Expand Down
6 changes: 3 additions & 3 deletions src/funnel/register/LocationFunnel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,18 @@ const LocationFunnel = ({ toNotificationTimeFunnel, goBack }: LocationFunnelProp
description="거주하시는 시와 구 or 군을 입력해주세요."
placeholder={'ex) 서울시 강남구'}
onChange={changeSearchHandler}
onClear={() => setSearch('')}
/>
<HeightBox height={15.75} />
<Suspense
fallback={
<div className={'mt-[30px] flex items-center justify-center'}>
<LuLoader2 className={'animate-spin'} />
<div className={'flex justify-center h-full'}>
<LuLoader2 className={'mt-6 animate-spin'} />
</div>
}
>
<RegionList search={search} onSelectLocation={onSelectLocation} />
</Suspense>
<HeightBox height={'100%'} />
<CTAButton
text={'다음'}
className={cn(selectedLocation === null ? 'bg-Gray300' : 'bg-BloomingGreen500')}
Expand Down
2 changes: 2 additions & 0 deletions src/pages/ErrorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import CTAButton from '@/components/common/CTAButton';
import TabBar from '@/components/main/TabBar';
import Screen from '@/layouts/Screen';

// TODO: 다시 시도 버튼 기능 구현하기

const ErrorPage = () => {
return (
<Screen className="flex items-center justify-center h-screen p-0">
Expand Down
10 changes: 9 additions & 1 deletion src/pages/RegisterPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import useInternalRouter from '@/hooks/useInternalRouter.ts';
import { ONE_DAY } from '@/constants/day.ts';
import { useCookies } from 'react-cookie';
import LoadingScreen from '@/components/common/LoadingScreen';
import useToast from '@/hooks/useToast.tsx';

type RegisterForm = {
nickname: string;
Expand All @@ -24,6 +25,7 @@ const RegisterPage = () => {
location: '',
locationId: undefined,
});
const { openToast } = useToast();

const [step, setStep] = useState<
'닉네임입력' | '주소입력' | '알림시간대입력' | '완료하기' | '로딩'
Expand Down Expand Up @@ -57,7 +59,13 @@ const RegisterPage = () => {
});
},
onError: () => {
// TODO: 에러 퍼널 보여주기
openToast({
message: (
<p className="flex flex-row items-center justify-center w-full gap-2 text-small-body font-medium text-white">
회원가입에 실패했습니다. 다시 시도해주세요.
</p>
),
});
},
},
);
Expand Down
Loading