1- import { useState } from 'react'
1+ import { useState } from 'react'
22import clsx from 'clsx'
33import Image from 'next/image'
4- import Router from 'next/router'
5- import { buildArray } from 'common/util/array'
6- import { Carousel } from 'web/components/widgets/carousel'
7- import { MODAL_CLASS , Modal } from 'web/components/layout/modal'
8- import { Col } from 'web/components/layout/col'
9- import { SignUpButton } from './nav/sidebar'
10- import { Profile } from 'common/profiles/profile'
11- import { useAdmin } from 'web/hooks/use-admin'
12- import { Button } from 'web/components/buttons/button'
13- import { updateProfile } from 'web/lib/api'
14- import { Row } from 'web/components/layout/row'
15- import { useUser } from 'web/hooks/use-user'
16- import { PlusIcon } from '@heroicons/react/solid'
17- import { api } from 'web/lib/api'
18- import { EditablePhotoGrid } from './widgets/editable-photo-grid'
19- import { AddPhotosWidget } from './widgets/add-photos'
4+ import { buildArray } from 'common/util/array'
5+ import { Carousel } from 'web/components/widgets/carousel'
6+ import { Modal , MODAL_CLASS } from 'web/components/layout/modal'
7+ import { Col } from 'web/components/layout/col'
8+ import { SignUpButton } from './nav/sidebar'
9+ import { Profile } from 'common/profiles/profile'
10+ import { Button } from 'web/components/buttons/button'
11+ import { updateProfile } from 'web/lib/api'
12+ import { Row } from 'web/components/layout/row'
13+ import { useUser } from 'web/hooks/use-user'
14+ import { PlusIcon } from '@heroicons/react/solid'
15+ import { EditablePhotoGrid } from './widgets/editable-photo-grid'
16+ import { AddPhotosWidget } from './widgets/add-photos'
2017
2118export default function ProfileCarousel ( props : { profile : Profile } ) {
22- const { profile } = props
19+ const { profile} = props
2320 const photoNums = profile . photo_urls ? profile . photo_urls . length : 0
2421
2522 const [ lightboxUrl , setLightboxUrl ] = useState ( '' )
@@ -30,7 +27,6 @@ export default function ProfileCarousel(props: { profile: Profile }) {
3027 const [ pinnedUrl , setPinnedUrl ] = useState < string | null > ( profile . pinned_url )
3128 const [ photoUrls , setPhotoUrls ] = useState < string [ ] > ( profile . photo_urls ?? [ ] )
3229
33- const isAdmin = useAdmin ( )
3430 const currentUser = useUser ( )
3531 const isCurrentUser = currentUser ?. id === profile . user_id
3632
@@ -59,7 +55,8 @@ export default function ProfileCarousel(props: { profile: Profile }) {
5955 </ div >
6056 ) }
6157 { photoNums > 0 && (
62- < Col className = "bg-canvas-100 dark:bg-canvas-0 text-ink-500 relative h-80 w-[250px] flex-none items-center rounded text-6xl " >
58+ < Col
59+ className = "bg-canvas-100 dark:bg-canvas-0 text-ink-500 relative h-80 w-[250px] flex-none items-center rounded text-6xl " >
6360 < Col className = " m-auto items-center gap-1" >
6461 < div className = "select-none font-semibold" > +{ photoNums } </ div >
6562 < SignUpButton
@@ -78,19 +75,6 @@ export default function ProfileCarousel(props: { profile: Profile }) {
7875 return (
7976 < >
8077 < div className = "flex gap-2 self-end" >
81- { isAdmin && (
82- < Button
83- size = "sm"
84- color = "red"
85- onClick = { ( ) => {
86- api ( 'remove-pinned-photo' , { userId : profile . user_id } ) . then ( ( ) =>
87- Router . back ( )
88- )
89- } }
90- >
91- Admin: Delete pinned photo
92- </ Button >
93- ) }
9478 { isCurrentUser && ! isEditMode && (
9579 < Button
9680 onClick = { ( ) => setIsEditMode ( true ) }
@@ -158,7 +142,7 @@ export default function ProfileCarousel(props: { profile: Profile }) {
158142 size = "sm"
159143 className = "self-start"
160144 >
161- < PlusIcon className = "mr-1 h-5 w-5" />
145+ < PlusIcon className = "mr-1 h-5 w-5" />
162146 Add photos
163147 </ Button >
164148 </ Col >
@@ -186,14 +170,14 @@ export default function ProfileCarousel(props: { profile: Profile }) {
186170 className = "bg-ink-200 text-ink-0 group flex h-80 w-[250px] flex-none cursor-pointer snap-start items-center justify-center rounded ease-in-out"
187171 onClick = { ( ) => setAddPhotosOpen ( true ) }
188172 >
189- < PlusIcon className = "w-20 transition-all group-hover:w-24" />
173+ < PlusIcon className = "w-20 transition-all group-hover:w-24" />
190174 </ button >
191175 ) }
192176 </ Carousel >
193177 ) }
194178
195179 < Modal open = { lightboxOpen } setOpen = { setLightboxOpen } >
196- < Image src = { lightboxUrl } width = { 1000 } height = { 1000 } alt = "" />
180+ < Image src = { lightboxUrl } width = { 1000 } height = { 1000 } alt = "" />
197181 </ Modal >
198182
199183 { isCurrentUser && (
0 commit comments