Skip to content

Commit

Permalink
No longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
4lejandrito committed Nov 8, 2022
1 parent 9954ada commit 923b918
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
5 changes: 2 additions & 3 deletions packages/creepyface-site/pages/api/img/[...parts].ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fileRoute, pendingRoute } from '../../../src/backend/api'
import resize, { Size } from '../../../src/backend/resize'
import resize from '../../../src/backend/resize'
import toGif from '../../../src/backend/gif'

export default pendingRoute(async (req, res) => {
Expand All @@ -15,8 +15,7 @@ export default pendingRoute(async (req, res) => {
}

const name = (req.query.parts?.[1] as string) || 'serious'
const size = (req.query.parts?.[2] as Size) || 'medium'
const path = await resize(uuid, name, size)
const path = await resize(uuid, name)

return fileRoute(path)(req, res)
})
3 changes: 1 addition & 2 deletions packages/creepyface-site/src/backend/resize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { getImagePath, getThumbnailPath } from './storage'
import path from 'path'
import { smallImageSize } from '../util/constants'

export const sizes = ['medium', 'small', 'square'] as const
export const sizes = ['medium', 'small'] as const
export type Size = typeof sizes[number]

const getDimensions = (size: Size) =>
({
small: { width: smallImageSize, height: smallImageSize },
medium: { width: Math.floor((400 * 35) / 45), height: 400 },
square: { width: 400, height: 400 },
}[size] || { width: 0, height: 0 })

export default async function resize(uuid: string, name: string, size?: Size) {
Expand Down
8 changes: 3 additions & 5 deletions packages/creepyface-site/src/components/CreepyFace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export default function CreepyFace(props: {
id?: string
alt?: string
images: Images | null
hidden?: boolean
points?: string
timeToDefault?: number
draggable?: boolean
Expand All @@ -123,7 +122,6 @@ export default function CreepyFace(props: {
id,
alt,
images,
hidden,
points,
timeToDefault,
onClick,
Expand Down Expand Up @@ -161,7 +159,7 @@ export default function CreepyFace(props: {
setLongPressed(false)
}}
>
{!hidden && images && (
{images && (
<Creepyface
alt={alt}
src={images.src}
Expand All @@ -179,12 +177,12 @@ export default function CreepyFace(props: {
onLoad={() => setLoaded(true)}
/>
)}
{(!loaded || firstAttach || hidden || !images) && (
{(!loaded || firstAttach || !images) && (
<div className="placeholder">
<FaceIcon seed={hash(id ?? images?.src ?? '')} />
</div>
)}
{!hidden && (images?.loading || !attached || !loaded) && <Loader />}
{(images?.loading || !attached || !loaded) && <Loader />}
</button>
)
}

0 comments on commit 923b918

Please sign in to comment.