From 13dad9a10c821c4248145d920c3e1028aeb88235 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Tue, 27 Sep 2022 19:03:14 -0400 Subject: [PATCH] Date doc: Remove photo as first-class feature --- common/post.ts | 1 - functions/src/create-post.ts | 1 - web/pages/date-docs/[username].tsx | 7 +--- web/pages/date-docs/create.tsx | 57 +----------------------------- 4 files changed, 2 insertions(+), 64 deletions(-) diff --git a/common/post.ts b/common/post.ts index 13a90821..45503b22 100644 --- a/common/post.ts +++ b/common/post.ts @@ -12,7 +12,6 @@ export type Post = { export type DateDoc = Post & { bounty: number birthday: number - photoUrl: string type: 'date-doc' contractSlug: string } diff --git a/functions/src/create-post.ts b/functions/src/create-post.ts index a342dc05..675ce3e1 100644 --- a/functions/src/create-post.ts +++ b/functions/src/create-post.ts @@ -42,7 +42,6 @@ const postSchema = z.object({ // Date doc fields: bounty: z.number().optional(), birthday: z.number().optional(), - photoUrl: z.string().optional(), type: z.string().optional(), question: z.string().optional(), }) diff --git a/web/pages/date-docs/[username].tsx b/web/pages/date-docs/[username].tsx index d6ac37cd..2b6c4909 100644 --- a/web/pages/date-docs/[username].tsx +++ b/web/pages/date-docs/[username].tsx @@ -85,7 +85,7 @@ export function DateDocPost(props: { link?: boolean }) { const { dateDoc, creator, link } = props - const { content, birthday, photoUrl, contractSlug } = dateDoc + const { content, birthday, contractSlug } = dateDoc const { name, username } = creator const user = useUser() @@ -133,11 +133,6 @@ export function DateDocPost(props: { - {name} {user && user.id === creator.id ? ( diff --git a/web/pages/date-docs/create.tsx b/web/pages/date-docs/create.tsx index 5d72da42..6065796d 100644 --- a/web/pages/date-docs/create.tsx +++ b/web/pages/date-docs/create.tsx @@ -13,8 +13,6 @@ import { Button } from 'web/components/button' import dayjs from 'dayjs' import { MINUTE_MS } from 'common/util/time' import { Col } from 'web/components/layout/col' -import { uploadImage } from 'web/lib/firebase/storage' -import { LoadingIndicator } from 'web/components/loading-indicator' import { MAX_QUESTION_LENGTH } from 'common/contract' export default function CreateDateDocPage() { @@ -26,8 +24,6 @@ export default function CreateDateDocPage() { const title = `${user?.name}'s Date Doc` const [birthday, setBirthday] = useState(undefined) - const [photoUrl, setPhotoUrl] = useState('') - const [avatarLoading, setAvatarLoading] = useState(false) const [question, setQuestion] = useState( 'Will I find a partner in the next 3 months?' ) @@ -40,30 +36,7 @@ export default function CreateDateDocPage() { const birthdayTime = birthday ? dayjs(birthday).valueOf() : undefined const isValid = - user && - birthday && - photoUrl && - editor && - editor.isEmpty === false && - question - - const fileHandler = async (event: any) => { - if (!user) return - - const file = event.target.files[0] - - setAvatarLoading(true) - - await uploadImage(user.username, file) - .then(async (url) => { - setPhotoUrl(url) - setAvatarLoading(false) - }) - .catch(() => { - setAvatarLoading(false) - setPhotoUrl('') - }) - } + user && birthday && editor && editor.isEmpty === false && question async function saveDateDoc() { if (!user || !editor || !birthdayTime) return @@ -76,7 +49,6 @@ export default function CreateDateDocPage() { content: editor.getJSON(), bounty: 0, birthday: birthdayTime, - photoUrl, type: 'date-doc', question, } @@ -122,33 +94,6 @@ export default function CreateDateDocPage() { /> - -
Photo
- - {avatarLoading ? ( - - ) : ( - <> - {photoUrl && ( - - )} - - - )} - - -
Tell us about you! What are you looking for?