@daeryun/dr_components 0.9.44 → 0.9.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -202,7 +202,6 @@ const StepOne = () => {
202
202
  // 필요시 에러 처리 로직 추가
203
203
  }
204
204
  });
205
- // 다음 버튼 클릭 시 세션 스토리지에 category 값 저장
206
205
  const handleNext = () => __awaiter(void 0, void 0, void 0, function* () {
207
206
  if (selectedList.length === 0) {
208
207
  return;
@@ -217,7 +216,8 @@ const StepOne = () => {
217
216
  console.error('Session storage parsing error:', e);
218
217
  }
219
218
  }
220
- const updatedLoginData = Object.assign(Object.assign({}, loginData), { selectedCategories: selectedList });
219
+ const updatedLoginData = Object.assign(Object.assign({}, loginData), { selectedCategories: selectedList, selectedFields: [] // 새로운 카테고리 선택 시 필드 초기화
220
+ });
221
221
  sessionStorage.setItem('login', JSON.stringify(updatedLoginData));
222
222
  window.location.href = '/login/sign/step_two';
223
223
  });
@@ -270,7 +270,6 @@ const StepOne = () => {
270
270
  }
271
271
  });
272
272
 
273
- // 다음 버튼 클릭 시 세션 스토리지에 category 값 저장
274
273
  const handleNext = async () => {
275
274
  if (selectedList.length === 0) {
276
275
  return;
@@ -289,14 +288,14 @@ const StepOne = () => {
289
288
 
290
289
  const updatedLoginData = {
291
290
  ...loginData,
292
- selectedCategories: selectedList
291
+ selectedCategories: selectedList,
292
+ selectedFields: [] // 새로운 카테고리 선택 시 필드 초기화
293
293
  };
294
294
 
295
295
  sessionStorage.setItem('login', JSON.stringify(updatedLoginData));
296
296
 
297
297
  window.location.href = '/login/sign/step_two';
298
298
  };
299
-
300
299
  const handleSkip = async () => {
301
300
  try {
302
301
  // session storage에서 login 정보 가져오기
@@ -13,6 +13,7 @@ import Image from 'next/image';
13
13
  import { useMutation } from '@tanstack/react-query';
14
14
  import { getCookie } from '../../../lib';
15
15
  import ConfirmModal from './LoginComp/Modal/ConfirmModal';
16
+ import Loader from '../../../components/Loader/Loader';
16
17
  const Box = ({ type_idx, tag_title, selected, selectedList, setSelectedList, activeTooltipId, setActiveTooltipId, tooltipTimeoutRef }) => {
17
18
  const [tooltipStyle, setTooltipStyle] = useState({});
18
19
  const buttonRef = useRef(null);
@@ -163,8 +164,7 @@ const StepTwo = () => {
163
164
  });
164
165
  const [centerCodes, setCenterCodes] = useState([]);
165
166
  const [fieldData, setFieldData] = useState({});
166
- const center_code = 'CT0001';
167
- const center_code2 = 'CT0025';
167
+ const [isLoading, setIsLoading] = useState(false);
168
168
  const categories = [
169
169
  { code: 'CT0004', code_name: '기업법무' },
170
170
  { code: 'CT0014', code_name: '지식재산권' },
@@ -207,288 +207,6 @@ const StepTwo = () => {
207
207
  return { result: false, data: [] };
208
208
  }
209
209
  });
210
- const data1 = {
211
- result: true,
212
- data: [
213
- {
214
- type_idx: 1713,
215
- tag_title: '뇌물수수'
216
- },
217
- {
218
- type_idx: 1937,
219
- tag_title: '업무상과실치사상'
220
- },
221
- {
222
- type_idx: 1914,
223
- tag_title: '데이트폭력처벌'
224
- },
225
- {
226
- type_idx: 6662,
227
- tag_title: '명의도용죄'
228
- },
229
- {
230
- type_idx: 2131,
231
- tag_title: '횡령·횡령죄'
232
- },
233
- {
234
- type_idx: 1967,
235
- tag_title: '음주운전범죄'
236
- },
237
- {
238
- type_idx: 1873,
239
- tag_title: '유사수신행위'
240
- },
241
- {
242
- type_idx: 1649,
243
- tag_title: '강도죄'
244
- },
245
- {
246
- type_idx: 1836,
247
- tag_title: '보이스피싱'
248
- },
249
- {
250
- type_idx: 8947,
251
- tag_title: '주민등록법위반'
252
- },
253
- {
254
- type_idx: 1954,
255
- tag_title: '영업비밀보호법'
256
- },
257
- {
258
- type_idx: 1694,
259
- tag_title: '공직선거법위반'
260
- },
261
- {
262
- type_idx: 2809,
263
- tag_title: '통신비밀보호법위반'
264
- },
265
- {
266
- type_idx: 2594,
267
- tag_title: '위증죄/증거인멸죄'
268
- },
269
- {
270
- type_idx: 1858,
271
- tag_title: '사기죄'
272
- },
273
- {
274
- type_idx: 6664,
275
- tag_title: '아동복지법위반'
276
- },
277
- {
278
- type_idx: 6600,
279
- tag_title: '감금죄'
280
- },
281
- {
282
- type_idx: 1746,
283
- tag_title: '도박죄'
284
- },
285
- {
286
- type_idx: 1927,
287
- tag_title: '업무방해죄'
288
- },
289
- {
290
- type_idx: 1684,
291
- tag_title: '교통사고범죄'
292
- },
293
- {
294
- type_idx: 2801,
295
- tag_title: '장애인복지법위반'
296
- },
297
- {
298
- type_idx: 6623,
299
- tag_title: '경찰사칭죄 '
300
- },
301
- {
302
- type_idx: 2138,
303
- tag_title: '학교폭력'
304
- },
305
- {
306
- type_idx: 3398,
307
- tag_title: '대부업법위반'
308
- },
309
- {
310
- type_idx: 8199,
311
- tag_title: '배임·배임죄'
312
- },
313
- {
314
- type_idx: 1829,
315
- tag_title: '보복운전/난폭운전'
316
- },
317
- {
318
- type_idx: 7547,
319
- tag_title: '가상화폐사기'
320
- },
321
- {
322
- type_idx: 1753,
323
- tag_title: '마약류관리법위반'
324
- },
325
- {
326
- type_idx: 6627,
327
- tag_title: '공무상비밀누설죄'
328
- },
329
- {
330
- type_idx: 2077,
331
- tag_title: '정치자금법위반'
332
- },
333
- {
334
- type_idx: 6630,
335
- tag_title: '공중위생관리법'
336
- },
337
- {
338
- type_idx: 6659,
339
- tag_title: '기물파손죄'
340
- },
341
- {
342
- type_idx: 6602,
343
- tag_title: '강제집행면탈죄'
344
- },
345
- {
346
- type_idx: 2125,
347
- tag_title: '강요죄'
348
- },
349
- {
350
- type_idx: 2815,
351
- tag_title: '보험사기죄'
352
- },
353
- {
354
- type_idx: 8204,
355
- tag_title: '상해'
356
- },
357
- {
358
- type_idx: 1983,
359
- tag_title: '절도죄'
360
- },
361
- {
362
- type_idx: 6633,
363
- tag_title: '국민체육진흥법위반 '
364
- },
365
- {
366
- type_idx: 1771,
367
- tag_title: '명예훼손/허위사실유포'
368
- },
369
- {
370
- type_idx: 1825,
371
- tag_title: '방화죄'
372
- },
373
- {
374
- type_idx: 1902,
375
- tag_title: '스토킹처벌법'
376
- },
377
- {
378
- type_idx: 2101,
379
- tag_title: '폭행·폭행죄'
380
- },
381
- {
382
- type_idx: 1804,
383
- tag_title: '무고죄'
384
- },
385
- {
386
- type_idx: 1971,
387
- tag_title: '재물손괴죄'
388
- },
389
- {
390
- type_idx: 1706,
391
- tag_title: '교육감선거'
392
- },
393
- {
394
- type_idx: 1997,
395
- tag_title: '주거침입죄'
396
- },
397
- {
398
- type_idx: 1817,
399
- tag_title: '문서위조/변조'
400
- },
401
- {
402
- type_idx: 1779,
403
- tag_title: '사이버명예훼손'
404
- },
405
- {
406
- type_idx: 2931,
407
- tag_title: '특경법'
408
- },
409
- {
410
- type_idx: 1992,
411
- tag_title: '특정범죄가중처벌법'
412
- },
413
- {
414
- type_idx: 1918,
415
- tag_title: '아동학대'
416
- },
417
- {
418
- type_idx: 1961,
419
- tag_title: '음주운전동승자처벌'
420
- },
421
- {
422
- type_idx: 2116,
423
- tag_title: '협박죄'
424
- },
425
- {
426
- type_idx: 1661,
427
- tag_title: '개인정보보호법위반'
428
- },
429
- {
430
- type_idx: 1786,
431
- tag_title: '모욕죄'
432
- },
433
- {
434
- type_idx: 1729,
435
- tag_title: '뇌물알선수재죄'
436
- },
437
- {
438
- type_idx: 1680,
439
- tag_title: '공갈죄'
440
- },
441
- {
442
- type_idx: 2094,
443
- tag_title: '부정청탁금지법'
444
- },
445
- {
446
- type_idx: 1843,
447
- tag_title: '전자금융거래법위반'
448
- },
449
- {
450
- type_idx: 1886,
451
- tag_title: '살인죄'
452
- },
453
- {
454
- type_idx: 1690,
455
- tag_title: '공무집행방해죄'
456
- }
457
- ]
458
- };
459
- const data2 = {
460
- result: true,
461
- data: [
462
- {
463
- type_idx: 2615,
464
- tag_title: '엔터테인먼트'
465
- },
466
- {
467
- type_idx: 2634,
468
- tag_title: '게임산업'
469
- },
470
- {
471
- type_idx: 2649,
472
- tag_title: '저작권'
473
- },
474
- {
475
- type_idx: 2717,
476
- tag_title: '상표/디자인'
477
- },
478
- {
479
- type_idx: 2662,
480
- tag_title: '전속계약'
481
- },
482
- {
483
- type_idx: 2620,
484
- tag_title: '스포츠산업'
485
- },
486
- {
487
- type_idx: 2693,
488
- tag_title: '특허/실용신안'
489
- }
490
- ]
491
- };
492
210
  const modalHandleClose = () => {
493
211
  setIsModal(false);
494
212
  setModalObj({ title: '', subTitle: '' });
@@ -537,9 +255,21 @@ const StepTwo = () => {
537
255
  }
538
256
  });
539
257
  const handlePrev = () => {
258
+ try {
259
+ const existingLogin = sessionStorage.getItem('login');
260
+ if (existingLogin) {
261
+ const loginData = JSON.parse(existingLogin);
262
+ delete loginData.selectedFields; // selectedFields 제거
263
+ sessionStorage.setItem('login', JSON.stringify(loginData));
264
+ }
265
+ }
266
+ catch (error) {
267
+ console.error('SessionStorage 업데이트 실패:', error);
268
+ }
540
269
  window.location.href = '/login/sign/step_one';
541
270
  };
542
271
  const handleDone = () => __awaiter(void 0, void 0, void 0, function* () {
272
+ setIsLoading(true);
543
273
  if (selectedList.length === 0) {
544
274
  return;
545
275
  }
@@ -570,6 +300,9 @@ const StepTwo = () => {
570
300
  catch (error) {
571
301
  console.error('Session storage parsing error:', error);
572
302
  }
303
+ finally {
304
+ setIsLoading(false);
305
+ }
573
306
  });
574
307
  // 페이지 로드 시 sessionStorage에서 선택된 카테고리를 읽어서 API 호출
575
308
  useEffect(() => {
@@ -609,6 +342,8 @@ const StepTwo = () => {
609
342
  initializeData();
610
343
  }, []);
611
344
  return (<>
345
+ {isLoading && <Loader fullScreen/>}
346
+
612
347
  <div className="relative mx-[200px] mt-[150px] max-[1498px]:mx-[120px] max-lg:mx-[60px] max-sm:mx-[20px] sm:mt-[240px] lg:mt-[200px] ">
613
348
  <div className="">
614
349
  <p className="title_large_mo sm:title_large_tb lg:title_large">STEP 2</p>
@@ -631,7 +366,7 @@ const StepTwo = () => {
631
366
  </div>
632
367
  </div>
633
368
 
634
- <div className="mt-[28px] flex flex-col gap-[40px] sm:mt-[61px] lg:mt-[66px] ">
369
+ <div className="mt-[28px] flex flex-col gap-[40px] sm:mt-[61px] lg:mt-[66px] ">
635
370
  {/* {data1?.data?.length > 0 && (
636
371
  <div className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
637
372
  <p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:sm:flex-shrink-0">
@@ -680,6 +415,24 @@ const StepTwo = () => {
680
415
  </div>
681
416
  </div>
682
417
  )} */}
418
+ {centerCodes.map((centerCode, index) => {
419
+ var _a, _b;
420
+ const currentFieldData = fieldData[centerCode];
421
+ const categoryName = (_a = categories.find(item => item.code === centerCode)) === null || _a === void 0 ? void 0 : _a.code_name;
422
+ if (!((_b = currentFieldData === null || currentFieldData === void 0 ? void 0 : currentFieldData.data) === null || _b === void 0 ? void 0 : _b.length)) {
423
+ return null;
424
+ }
425
+ return (<div key={centerCode} className="sm:flex sm:flex-row sm:rounded-[16px] sm:border sm:border-solid sm:border-grayScale5 sm:p-[40px] lg:rounded-[20px]">
426
+ <p className="body_large1_mo sm:body_large1_tb lg:body_large1 sm:w-[150px] sm:flex-shrink-0">
427
+ {categoryName}
428
+ </p>
429
+ <div className="my-[12px] w-full bg-grayScale5 max-sm:h-[1px] sm:mx-[44px] sm:my-0 sm:h-auto sm:w-[1px] sm:flex-shrink-0 lg:gap-[80px]"/>
430
+
431
+ <div className={`flex flex-row flex-wrap gap-x-[8px] gap-y-[12px] sm:gap-[20px] lg:gap-x-[24px] ${index === 1 ? 'lg:gap-y-[32px]' : 'lg:gap-y-[24px]'}`}>
432
+ {currentFieldData.data.map(item => (<Box key={item.type_idx} type_idx={item.type_idx} tag_title={item.tag_title} selected={selectedList.includes(item.type_idx)} selectedList={selectedList} setSelectedList={setSelectedList} activeTooltipId={activeTooltipId} setActiveTooltipId={setActiveTooltipId} tooltipTimeoutRef={tooltipTimeoutRef}/>))}
433
+ </div>
434
+ </div>);
435
+ })}
683
436
  </div>
684
437
  <div className="mb-[56px] mt-[40px] flex flex-col items-center justify-center sm:mt-[60px] lg:mt-[79px]">
685
438
  <div className="flex w-full flex-row items-center justify-center gap-[8px]">