diff --git a/web/components/buttons/more-options-user-button.tsx b/web/components/buttons/more-options-user-button.tsx index 79632083..27f37ee4 100644 --- a/web/components/buttons/more-options-user-button.tsx +++ b/web/components/buttons/more-options-user-button.tsx @@ -1,32 +1,33 @@ -import { usePrivateUser } from 'web/hooks/use-user' -import { Button } from 'web/components/buttons/button' -import { Modal } from 'web/components/layout/modal' -import { useState } from 'react' -import { Col } from 'web/components/layout/col' -import { User } from 'common/user' +import {usePrivateUser} from 'web/hooks/use-user' +import {Button} from 'web/components/buttons/button' +import {Modal} from 'web/components/layout/modal' +import {useState} from 'react' +import {Col} from 'web/components/layout/col' +import {User} from 'common/user' import clsx from 'clsx' -import { DotsHorizontalIcon } from '@heroicons/react/outline' -import { useAdmin, useTrusted } from 'web/hooks/use-admin' -import { UncontrolledTabs } from 'web/components/layout/tabs' -import { BlockUser } from 'web/components/profile/block-user' -import { ReportUser } from 'web/components/profile/report-user' -import { Title } from 'web/components/widgets/title' -import { Row } from '../layout/row' -import { SimpleCopyTextButton } from 'web/components/buttons/copy-link-button' -import { api } from 'web/lib/api' -import { buildArray } from 'common/util/array' -import { DeleteYourselfButton } from '../profile/delete-yourself' +import {DotsHorizontalIcon} from '@heroicons/react/outline' +import {useAdmin, useTrusted} from 'web/hooks/use-admin' +import {UncontrolledTabs} from 'web/components/layout/tabs' +import {BlockUser} from 'web/components/profile/block-user' +import {ReportUser} from 'web/components/profile/report-user' +import {Title} from 'web/components/widgets/title' +import {Row} from '../layout/row' +import {SimpleCopyTextButton} from 'web/components/buttons/copy-link-button' +import {api} from 'web/lib/api' +import {buildArray} from 'common/util/array' +import {DeleteYourselfButton} from '../profile/delete-yourself' import {toast} from "react-hot-toast"; +import Router from "next/router"; export function MoreOptionsUserButton(props: { user: User }) { - const { user } = props - const { id: userId, name } = user + const {user} = props + const {id: userId, name} = user const currentPrivateUser = usePrivateUser() const [isModalOpen, setIsModalOpen] = useState(false) const isAdmin = useAdmin() const isTrusted = useTrusted() - if (!currentPrivateUser) return
+ if (!currentPrivateUser) return
const createdTime = new Date(user.createdTime).toLocaleDateString('en-us', { year: 'numeric', @@ -76,6 +77,17 @@ export function MoreOptionsUserButton(props: { user: User }) { > {user.isBannedFromPosting ? 'Banned' : 'Ban User'} + )}
@@ -100,36 +112,36 @@ export function MoreOptionsUserButton(props: { user: User }) { // TODO: if isYou include a tab for users you've blocked? isYou ? [ - { - title: 'Delete Account', - content: ( -
- -
- ), - }, - ] + { + title: 'Delete Account', + content: ( +
+ +
+ ), + }, + ] : [ - { - title: 'Block', - content: ( - setIsModalOpen(false)} - /> - ), - }, - { - title: 'Report', - content: ( - setIsModalOpen(false)} - /> - ), - }, - ], + { + title: 'Block', + content: ( + setIsModalOpen(false)} + /> + ), + }, + { + title: 'Report', + content: ( + setIsModalOpen(false)} + /> + ), + }, + ], ])} /> diff --git a/web/components/profile-carousel.tsx b/web/components/profile-carousel.tsx index abe9c0cf..83eec333 100644 --- a/web/components/profile-carousel.tsx +++ b/web/components/profile-carousel.tsx @@ -1,25 +1,22 @@ -import { useState } from 'react' +import {useState} from 'react' import clsx from 'clsx' import Image from 'next/image' -import Router from 'next/router' -import { buildArray } from 'common/util/array' -import { Carousel } from 'web/components/widgets/carousel' -import { MODAL_CLASS, Modal } from 'web/components/layout/modal' -import { Col } from 'web/components/layout/col' -import { SignUpButton } from './nav/sidebar' -import { Profile } from 'common/profiles/profile' -import { useAdmin } from 'web/hooks/use-admin' -import { Button } from 'web/components/buttons/button' -import { updateProfile } from 'web/lib/api' -import { Row } from 'web/components/layout/row' -import { useUser } from 'web/hooks/use-user' -import { PlusIcon } from '@heroicons/react/solid' -import { api } from 'web/lib/api' -import { EditablePhotoGrid } from './widgets/editable-photo-grid' -import { AddPhotosWidget } from './widgets/add-photos' +import {buildArray} from 'common/util/array' +import {Carousel} from 'web/components/widgets/carousel' +import {Modal, MODAL_CLASS} from 'web/components/layout/modal' +import {Col} from 'web/components/layout/col' +import {SignUpButton} from './nav/sidebar' +import {Profile} from 'common/profiles/profile' +import {Button} from 'web/components/buttons/button' +import {updateProfile} from 'web/lib/api' +import {Row} from 'web/components/layout/row' +import {useUser} from 'web/hooks/use-user' +import {PlusIcon} from '@heroicons/react/solid' +import {EditablePhotoGrid} from './widgets/editable-photo-grid' +import {AddPhotosWidget} from './widgets/add-photos' export default function ProfileCarousel(props: { profile: Profile }) { - const { profile } = props + const {profile} = props const photoNums = profile.photo_urls ? profile.photo_urls.length : 0 const [lightboxUrl, setLightboxUrl] = useState('') @@ -30,7 +27,6 @@ export default function ProfileCarousel(props: { profile: Profile }) { const [pinnedUrl, setPinnedUrl] = useState(profile.pinned_url) const [photoUrls, setPhotoUrls] = useState(profile.photo_urls ?? []) - const isAdmin = useAdmin() const currentUser = useUser() const isCurrentUser = currentUser?.id === profile.user_id @@ -59,7 +55,8 @@ export default function ProfileCarousel(props: { profile: Profile }) {
)} {photoNums > 0 && ( - +
+{photoNums}
- {isAdmin && ( - - )} {isCurrentUser && !isEditMode && ( @@ -186,14 +170,14 @@ export default function ProfileCarousel(props: { profile: Profile }) { 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" onClick={() => setAddPhotosOpen(true)} > - + )} )} - + {isCurrentUser && (