1
1
'use client' ;
2
2
3
3
/* eslint-disable no-continue */
4
- import { Container } from '@/components/Container' ;
5
4
import { Divider } from '@/components/Divider' ;
6
5
import { ImportList } from '@/components/Import/ImportList' ;
7
6
import { UploadedItem } from '@/components/Import/UploadedItem' ;
@@ -22,8 +21,7 @@ import Dropzone from 'react-dropzone';
22
21
import { MdFileUpload , MdWarning } from 'react-icons/md' ;
23
22
import { BlobReader , TextWriter , ZipReader } from '@zip.js/zip.js' ;
24
23
import { Button } from '@/components/Button' ;
25
-
26
- type Props = { } ;
24
+ import { AccountLayout } from '@/components/settings/Layout' ;
27
25
28
26
export const getServerSideProps : GetServerSideProps < SSRProps > = async ( ctx ) => {
29
27
const user = await fetchUser ( ctx ) ;
@@ -43,7 +41,7 @@ interface ImportService {
43
41
handleFileUpload : ( file : File [ ] ) => Promise < void > | void ;
44
42
}
45
43
46
- const ImportPage : NextPage < Props > = ( ) => {
44
+ const Imports = ( ) => {
47
45
const { user } = useAuth ( ) ;
48
46
const api = useApi ( ) ;
49
47
const toaster = useToaster ( ) ;
@@ -199,8 +197,8 @@ const ImportPage: NextPage<Props> = () => {
199
197
if ( ! user ) return < > </ > ;
200
198
201
199
return (
202
- < Container className = "pt-20 " >
203
- < Title > Import </ Title >
200
+ < div className = "relative w-full " >
201
+ < Title > Imports </ Title >
204
202
{ importWarning ?. asBoolean ( ) && (
205
203
< div className = "my-8 w-full flex-row rounded-md border-l-4 border-l-yellow-400/80 bg-yellow-400/20 p-4" >
206
204
< div className = "flex w-full flex-col" >
@@ -223,7 +221,7 @@ const ImportPage: NextPage<Props> = () => {
223
221
target = "blank"
224
222
onClick = { ( ) => event ( 'IMPORT_guide_click' ) }
225
223
>
226
- here in the support docs
224
+ in the support documentation.
227
225
</ a >
228
226
.
229
227
</ p >
@@ -232,17 +230,19 @@ const ImportPage: NextPage<Props> = () => {
232
230
{ importAvailable ?. asBoolean ( ) ? (
233
231
< >
234
232
< div className = "mt-5 flex flex-col items-center justify-center" >
235
- < SegmentedControls
236
- onChange = { ( id ) => {
237
- setImportService ( services . find ( ( x ) => x . id === id ) ! ) ;
238
- } }
239
- >
240
- { services . map ( ( service ) => (
241
- < Segment key = { service . id } value = { service . id } >
242
- { service . name }
243
- </ Segment >
244
- ) ) }
245
- </ SegmentedControls >
233
+ { services . length > 1 && (
234
+ < SegmentedControls
235
+ onChange = { ( id ) => {
236
+ setImportService ( services . find ( ( x ) => x . id === id ) ! ) ;
237
+ } }
238
+ >
239
+ { services . map ( ( service ) => (
240
+ < Segment key = { service . id } value = { service . id } >
241
+ { service . name }
242
+ </ Segment >
243
+ ) ) }
244
+ </ SegmentedControls >
245
+ ) }
246
246
< div className = "mt-2 flex w-full items-center justify-center" >
247
247
< Dropzone
248
248
onDrop = { ( files ) => importService . handleFileUpload ( files ) }
@@ -275,7 +275,9 @@ const ImportPage: NextPage<Props> = () => {
275
275
{ Object . values ( importService . acceptFiles )
276
276
. flatMap ( ( x ) => x )
277
277
. join ( ', ' ) } { ' ' }
278
- for this service.
278
+ for{ ' ' }
279
+ { services . length > 1 ? 'this service' : 'Spotify' }
280
+ .
279
281
</ p >
280
282
< input { ...getInputProps ( ) } />
281
283
</ >
@@ -345,7 +347,17 @@ const ImportPage: NextPage<Props> = () => {
345
347
you need stats.fm Plus.
346
348
</ h4 >
347
349
) }
348
- </ Container >
350
+ </ div >
351
+ ) ;
352
+ } ;
353
+
354
+ const ImportPage : NextPage = ( ) => {
355
+ const { user } = useAuth ( ) ;
356
+ if ( ! user ) return null ;
357
+ return (
358
+ < AccountLayout >
359
+ < Imports />
360
+ </ AccountLayout >
349
361
) ;
350
362
} ;
351
363
0 commit comments