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' ;
@@ -23,8 +22,7 @@ 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
24
import { Platform } from '@/utils/statsfm' ;
26
-
27
- type Props = { } ;
25
+ import { AccountLayout } from '@/components/settings/Layout' ;
28
26
29
27
export const getServerSideProps : GetServerSideProps < SSRProps > = async ( ctx ) => {
30
28
const user = await fetchUser ( ctx ) ;
@@ -44,7 +42,7 @@ interface ImportService {
44
42
handleFileUpload : ( file : File [ ] ) => Promise < void > | void ;
45
43
}
46
44
47
- const ImportPage : NextPage < Props > = ( ) => {
45
+ const Imports = ( ) => {
48
46
const { user } = useAuth ( ) ;
49
47
const api = useApi ( ) ;
50
48
const toaster = useToaster ( ) ;
@@ -226,8 +224,8 @@ const ImportPage: NextPage<Props> = () => {
226
224
if ( ! user ) return < > </ > ;
227
225
228
226
return (
229
- < Container className = "pt-20 " >
230
- < Title > Import </ Title >
227
+ < div className = "relative w-full " >
228
+ < Title > Imports </ Title >
231
229
{ importWarning ?. asBoolean ( ) && (
232
230
< div className = "my-8 w-full flex-row rounded-md border-l-4 border-l-yellow-400/80 bg-yellow-400/20 p-4" >
233
231
< div className = "flex w-full flex-col" >
@@ -250,7 +248,7 @@ const ImportPage: NextPage<Props> = () => {
250
248
target = "blank"
251
249
onClick = { ( ) => event ( 'IMPORT_guide_click' ) }
252
250
>
253
- here in the support docs
251
+ in the support documentation.
254
252
</ a >
255
253
.
256
254
</ p >
@@ -259,17 +257,19 @@ const ImportPage: NextPage<Props> = () => {
259
257
{ importAvailable ?. asBoolean ( ) ? (
260
258
< >
261
259
< div className = "mt-5 flex flex-col items-center justify-center" >
262
- < SegmentedControls
263
- onChange = { ( id ) => {
264
- setImportService ( services . find ( ( x ) => x . id === id ) ! ) ;
265
- } }
266
- >
267
- { services . map ( ( service ) => (
268
- < Segment key = { service . id } value = { service . id } >
269
- { service . name }
270
- </ Segment >
271
- ) ) }
272
- </ SegmentedControls >
260
+ { services . length > 1 && (
261
+ < SegmentedControls
262
+ onChange = { ( id ) => {
263
+ setImportService ( services . find ( ( x ) => x . id === id ) ! ) ;
264
+ } }
265
+ >
266
+ { services . map ( ( service ) => (
267
+ < Segment key = { service . id } value = { service . id } >
268
+ { service . name }
269
+ </ Segment >
270
+ ) ) }
271
+ </ SegmentedControls >
272
+ ) }
273
273
< div className = "mt-2 flex w-full items-center justify-center" >
274
274
< Dropzone
275
275
onDrop = { ( files ) => importService . handleFileUpload ( files ) }
@@ -302,7 +302,9 @@ const ImportPage: NextPage<Props> = () => {
302
302
{ Object . values ( importService . acceptFiles )
303
303
. flatMap ( ( x ) => x )
304
304
. join ( ', ' ) } { ' ' }
305
- for this service.
305
+ for{ ' ' }
306
+ { services . length > 1 ? 'this service' : 'Spotify' }
307
+ .
306
308
</ p >
307
309
< input { ...getInputProps ( ) } />
308
310
</ >
@@ -372,7 +374,17 @@ const ImportPage: NextPage<Props> = () => {
372
374
you need stats.fm Plus.
373
375
</ h4 >
374
376
) }
375
- </ Container >
377
+ </ div >
378
+ ) ;
379
+ } ;
380
+
381
+ const ImportPage : NextPage = ( ) => {
382
+ const { user } = useAuth ( ) ;
383
+ if ( ! user ) return null ;
384
+ return (
385
+ < AccountLayout >
386
+ < Imports />
387
+ </ AccountLayout >
376
388
) ;
377
389
} ;
378
390
0 commit comments