@daeryun/dr_components 1.3.13 → 1.3.15

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.
@@ -0,0 +1,181 @@
1
+ 'use client';
2
+
3
+ import Image from 'next/image';
4
+ import { useEffect, useState } from 'react';
5
+ import mobile from 'is-mobile';
6
+ import useBrowser from '../hook/useBrowser';
7
+ import AppIcon from '../../asset/images/GoToMYSJKP/app_icon.webp';
8
+ const GoToMYSJKP = () => {
9
+ const [isOpen, setIsOpen] = useState(false);
10
+ const { width } = useBrowser(true);
11
+ const [isMobile, setIsMobile] = useState<boolean>(false);
12
+ const [hideToday, setHideToday] = useState<boolean>(false);
13
+
14
+ const handleClose = () => {
15
+ if (hideToday) {
16
+ const nowDate = new Date();
17
+ const expires = nowDate.setHours(nowDate.getHours() + 24);
18
+ localStorage.setItem('myDaeryun', String(expires));
19
+ }
20
+ setIsOpen(false);
21
+ };
22
+
23
+ const handleOpenApp = () => {
24
+ if (typeof window === 'undefined' || typeof navigator === 'undefined') return;
25
+
26
+ const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
27
+ let isAndroid = /android/i.test(userAgent);
28
+ let isIOS = /iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream;
29
+
30
+ // const scheme = 'mydaeryun://'
31
+ const androidIntent = 'https://my.daeryunlaw.com';
32
+ const iosStore = 'https://my.daeryunlaw.com';
33
+
34
+ if (isMobile) {
35
+ const isIpad = /Macintosh/i.test(navigator.userAgent);
36
+ if (isIpad) {
37
+ //ios
38
+ isIOS = true;
39
+ } else {
40
+ //안드로이드
41
+ isAndroid = true;
42
+ }
43
+ } else {
44
+ console.log('모바일 환경이 아닙니다');
45
+ }
46
+
47
+ const now = Date.now();
48
+
49
+ if (isIOS) {
50
+ // iOS: 앱 실행 + 실패 시 앱스토어 이동
51
+ // window.location.href = scheme
52
+
53
+ // setTimeout(() => {
54
+ // if (Date.now() - now < 2000) {
55
+ window.location.href = iosStore;
56
+ // }
57
+ // }, 1000)
58
+ } else if (isAndroid) {
59
+ // Android: Intent 실행만
60
+ window.location.href = androidIntent;
61
+ // 앱 설치 여부는 브라우저가 자동으로 처리
62
+ } else {
63
+ console.log('모바일 환경이 아닙니다');
64
+ }
65
+ };
66
+
67
+ useEffect(() => {
68
+ setIsMobile(mobile({ tablet: true, featureDetect: true }));
69
+ }, [width]);
70
+
71
+ useEffect(() => {
72
+ const saved = localStorage.getItem('myDaeryun');
73
+ const now = new Date().getTime();
74
+
75
+ if (!saved) {
76
+ setIsOpen(true);
77
+ } else {
78
+ const expires = Number(saved);
79
+ if (now > expires) {
80
+ setIsOpen(true);
81
+ localStorage.removeItem('myDaeryun');
82
+ } else {
83
+ setIsOpen(false);
84
+ }
85
+ }
86
+ }, []);
87
+
88
+ return (
89
+ isOpen &&
90
+ width < 1024 &&
91
+ isMobile && (
92
+ <>
93
+ {/* bg */}
94
+ <div
95
+ className={
96
+ 'animate-fadeInFast fixed left-0 top-0 z-[9999] h-full w-full bg-[#000] bg-opacity-75 lg:pointer-events-none lg:hidden'
97
+ }
98
+ />
99
+ {/* 컨텐츠 */}
100
+ <span
101
+ className={
102
+ 'animate-fadeInFast fixed left-0 top-0 z-[9999] flex h-full w-full flex-col items-center justify-center px-[20px] text-white mix-blend-normal'
103
+ }
104
+ >
105
+ <button
106
+ onClick={handleClose}
107
+ className={
108
+ 'absolute right-[60px] top-[67px] z-[1] aspect-square w-[24px] max-sm:right-[20px] max-sm:top-[62px]'
109
+ }
110
+ >
111
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
112
+ <path
113
+ d="M2.39959 23.996L0 21.5964L9.59841 11.998L0 2.39962L2.39959 0L11.998 9.59838L21.5964 0L23.996 2.39962L14.3976 11.998L23.996 21.5964L21.5964 23.996L11.998 14.3976L2.39959 23.996Z"
114
+ fill="white"
115
+ />
116
+ </svg>
117
+ </button>
118
+ <Image
119
+ src={AppIcon}
120
+ alt={'mydaeryun_app_logo'}
121
+ width={92}
122
+ height={92}
123
+ unoptimized
124
+ className={'max-2sm:h-[72px] max-2sm:w-[72px]'}
125
+ />
126
+ <p className="mt-[40px] text-[28px] font-[800] tracking-[-0.02em] max-2sm:mt-[32px] max-2sm:text-[24px]">
127
+ MY SJKP 앱을 이용하면?
128
+ </p>
129
+ {/* <p className="mt-[40px] text-center text-[28px] font-[800] tracking-[-0.02em] max-2sm:mt-[32px] max-2sm:text-[24px]">
130
+ 쿠팡 집단소송,
131
+ <br />
132
+ MY대륜 앱에서 신청하세요!
133
+ </p> */}
134
+ <p className="mt-[16px] text-center text-[20px] font-[400] leading-[1.4] tracking-[-0.04em] max-2sm:mt-[12px] max-2sm:text-[18px]">
135
+ 법률 상담, 사건 조회,
136
+ <br />
137
+ 법률정보 검색이 더 편해집니다!
138
+ </p>
139
+ {/* <p className="mt-[16px] text-center text-[20px] font-[400] leading-[1.4] tracking-[-0.04em] max-2sm:mt-[12px] max-xs:text-[16px]">
140
+ 법률정보 검색·법률상담·사건관리를 하나의 앱으로!
141
+ <br />
142
+ <span className="font-bold text-yellow-400">집단소송 문의 및 접수는 MY대륜에서 가능</span>
143
+ 합니다.
144
+ <br />
145
+ <br />
146
+ <b>[ 쿠팡 집단소송 신청 Click ]</b>
147
+ </p> */}
148
+ <button
149
+ onClick={handleOpenApp}
150
+ className="mt-[40px] h-auto w-full max-w-[620px] rounded-full bg-[#AE0E36] py-[13px] text-[20px] font-bold tracking-[-0.04em] max-2sm:mt-[24px] max-2sm:py-[12px] max-2sm:text-[16px]"
151
+ >
152
+ 편리한 앱으로 보기
153
+ </button>
154
+ <button
155
+ onClick={handleClose}
156
+ className="mt-[20px] h-auto w-fit text-[18px] tracking-[-0.04em] max-2sm:text-[14px]"
157
+ >
158
+ 괜찮아요. 모바일웹으로 볼게요.
159
+ </button>
160
+
161
+ <span className="mt-[60px] flex w-full items-center justify-center gap-5 text-[18px] leading-none tracking-[-0.72px] max-2sm:mt-10 max-2sm:text-[14px] max-2sm:tracking-[-0.56px]">
162
+ <label className="flex items-center gap-2">
163
+ <input
164
+ id="hideToday"
165
+ type="checkbox"
166
+ checked={hideToday}
167
+ onChange={e => setHideToday(e.target.checked)}
168
+ className="h-4 w-4 appearance-none !rounded-[4px] border border-solid border-white checked:before:flex checked:before:items-center checked:before:justify-center checked:before:text-[14px] checked:before:font-bold checked:before:leading-none checked:before:content-['✓']"
169
+ />
170
+ 오늘 하루 보지 않기
171
+ </label>
172
+ <span className="block h-[24px] w-[1px] bg-white max-2sm:h-5"></span>
173
+ <button onClick={handleClose}>닫기</button>
174
+ </span>
175
+ </span>
176
+ </>
177
+ )
178
+ );
179
+ };
180
+
181
+ export default GoToMYSJKP;
@@ -2,7 +2,7 @@ export declare const getSearchKeywordJson: (searchKeywords: {
2
2
  code_name: string;
3
3
  survey_title: string;
4
4
  }[]) => {
5
- [x: string]: string[];
5
+ [key: string]: string[];
6
6
  };
7
7
  export declare const tabTypes: {
8
8
  tab: string;
@@ -80,5 +80,6 @@ export * from '../components/common/types/strength_new';
80
80
  export { default as PaginationForGroup } from './PaginationForGroup/PaginationForGroup';
81
81
  export { default as SuccessList } from './page/Success/SuccessList';
82
82
  export { default as GlobalOfficeSection } from './GlobalOfficeSection/GlobalOfficeSection';
83
+ export { default as GoToMYSJKP } from './GoToMYSJKP/GoToMYSJKP';
83
84
  // Hooks
84
85
  export { useLoginUuidSync } from './hook/useLoginUuidSync';
@@ -80,6 +80,7 @@ export * from '../components/common/types/strength_new';
80
80
  export { default as PaginationForGroup } from './PaginationForGroup/PaginationForGroup';
81
81
  export { default as SuccessList } from './page/Success/SuccessList';
82
82
  export { default as GlobalOfficeSection } from './GlobalOfficeSection/GlobalOfficeSection';
83
+ export { default as GoToMYSJKP } from './GoToMYSJKP/GoToMYSJKP';
83
84
 
84
85
  // Hooks
85
86
  export { useLoginUuidSync } from './hook/useLoginUuidSync';