The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
lw7: update all tickets with blurred background
Francesco Sansalvadore963c6774e7b4
diff --git a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallRow.tsx b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallRow.tsxindex 825a74ed4e9..da51778338e 100644--- a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallRow.tsx+++ b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallRow.tsx@@ -20,10 +20,7 @@ export function TicketBrickWallRow({ users, reverse, xOffset = 250 }: Props) {})const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'const getOgUrl = (username: string, isGold: boolean) =>- isGold- ? `${STORAGE_URL}/tickets/golden/${username}.png`- : `${STORAGE_URL}/tickets/${username}.png`-+ `${STORAGE_URL}/tickets/gallery/${isGold ? 'golden' : 'regular'}/v1/${username}.png`const x = useTransform(scrollYProgress, [0, 1], reverse ? [-xOffset, 0] : [0, -xOffset])return (diff --git a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallSlider.tsx b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallSlider.tsxindex 910a66bb0ea..877e8f14c6e 100644--- a/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallSlider.tsx+++ b/apps/www/components/LaunchWeek/LaunchSection/TicketBrickWallSlider.tsx@@ -22,7 +22,8 @@ export function TicketBrickWallSlider({ users, reverse, xOffset = 250, speed = 1const [swiperInstace, setSwiperInstance] = useState<SwiperCore | any | null>(null)const { width } = useWindowSize()const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'- const getOgUrl = (username: string) => `${STORAGE_URL}/tickets/gallery/${username}.png`+ const getOgUrl = (username: string, isGold: boolean) =>+ `${STORAGE_URL}/tickets/gallery/${isGold ? 'golden' : 'regular'}/v1/${username}.png`useEffect(() => {if (swiperInstace) swiperInstace?.autoplay?.run()@@ -65,7 +66,7 @@ export function TicketBrickWallSlider({ users, reverse, xOffset = 250, speed = 1<a className="relative !w-[230px] md:w-[450px] !h-[200px] transform scale-100 md:hover:scale-[101%] transition-transform"><div className="relative inset-0 w-full pt-[50%] transform rounded-md md:rounded-lg overflow-hidden"><Image- src={getOgUrl(user.username!)}+ src={getOgUrl(user.username!, !!user.golden)}alt={user.username}layout="fill"objectFit="cover"diff --git a/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx b/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsxindex ad4759c08fb..3226c1058df 100644--- a/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx+++ b/apps/www/components/LaunchWeek/Ticket/TicketVisual.tsx@@ -38,11 +38,11 @@ export default function TicketVisual({const ticketBg = {regular: {- image: `${storageBaseFilepath}/_jpg/reg_bg_${bgImageId}.jpg`,+ image: `${storageBaseFilepath}/blurred/regular/jpg/reg_bg_${bgImageId}.jpg`,overlay: `/images/launchweek/seven/ticket-overlay-reg.png`,},gold: {- image: `${storageBaseFilepath}/golden/_jpg/gold_bg_${bgImageId}.jpg`,+ image: `${storageBaseFilepath}/blurred/golden/jpg/gold_bg_${bgImageId}.jpg`,overlay: `/images/launchweek/seven/ticket-overlay-gold.png`,},}@@ -109,7 +109,7 @@ export default function TicketVisual({objectFit="cover"placeholder="blur"blurDataURL="/images/blur.png"- className="absolute inset-[1px] z-[1] "+ className="absolute inset-[1px] z-[1]"/>)}@@ -120,8 +120,8 @@ export default function TicketVisual({placeholder="blur"blurDataURL="/images/blur.png"className={[- 'duration-700 ease-in-out transform scale-105',- imageIsLoading ? 'grayscale blur-2xl scale-110' : 'grayscale-0 blur-0',+ 'duration-700 ease-in-out transform scale-110',+ imageIsLoading ? 'grayscale blur-xl scale-110' : 'grayscale-0 blur-0',].join(' ')}onLoadingComplete={() => setImageIsLoading(false)}/>diff --git a/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsxindex b3490b5f443..984be166a95 100644--- a/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx+++ b/apps/www/components/LaunchWeek/Ticket/TicketsGrid.tsx@@ -2,16 +2,18 @@ import { motion } from 'framer-motion'import Image from 'next/image'import Link from 'next/link'import { useMobileViewport } from '../../../hooks/useMobileViewport'+import { UserData } from './hooks/use-conf-data'interface Props {- loadedUsers: any[]+ loadedUsers: UserData[]isLoading: booleanpageCount: number}export default function TicketsGrid({ loadedUsers, isLoading, pageCount }: Props) {const STORAGE_URL = 'https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lw7'- const getOgUrl = (username: string) => `${STORAGE_URL}/tickets/gallery/${username}.png`+ const getOgUrl = (username: string, isGold: boolean) =>+ `${STORAGE_URL}/tickets/gallery/${isGold ? 'golden' : 'regular'}/v1/${username}.png`const isMobile = useMobileViewport(768)const isTablet = useMobileViewport(1024)@@ -44,7 +46,7 @@ export default function TicketsGrid({ loadedUsers, isLoading, pageCount }: Props><div className="relative inset-0 w-full pt-[50%]"><Image- src={getOgUrl(user.username!)}+ src={getOgUrl(user.username!, !!user.golden)}alt={user.username}layout="fill"objectFit="cover"diff --git a/apps/www/supabase/functions/lw7-ticket-gallery/handler.tsx b/apps/www/supabase/functions/lw7-ticket-gallery/handler.tsxindex efd24f45c98..72890c3675a 100644--- a/apps/www/supabase/functions/lw7-ticket-gallery/handler.tsx+++ b/apps/www/supabase/functions/lw7-ticket-gallery/handler.tsx@@ -14,7 +14,7 @@ export async function handler(req: Request) {if (req.method !== 'POST') throw new Error('method not supported')const {username = 'thorwebdev',- name = 'Thorsten Schaeff',+ name = 'Thoggen Schaeppy',ticketNumber = 1234,golden = true,bg_image_id = 80,@@ -29,11 +29,11 @@ export async function handler(req: Request) {// Else, generate image ad upload to storage.const BACKGROUND = {REG: {- AI: `${STORAGE_URL}/tickets_bg/reg_bg_${bg_image_id}.png`,+ AI: `${STORAGE_URL}/tickets_bg/blurred/regular/png/reg_bg_${bg_image_id}.png`,TICKET: `${STORAGE_URL}/reg_ticket_overlay.png`,},GOLD: {- AI: `${STORAGE_URL}/tickets_bg/golden/gold_bg_${bg_image_id}.png`,+ AI: `${STORAGE_URL}/tickets_bg/blurred/golden/png/gold_bg_${bg_image_id}.png`,TICKET: `${STORAGE_URL}/gold_ticket_overlay.png`,},}@@ -88,7 +88,7 @@ export async function handler(req: Request) {height="166"style={{position: 'absolute',- top: '150',+ top: '145',left: '400',borderRadius: 83,}}@@ -124,7 +124,7 @@ export async function handler(req: Request) {style={{margin: '0',fontSize: '50px',- lineHeight: '50px',+ lineHeight: '62px',}}>{name ?? username}@@ -198,11 +198,15 @@ export async function handler(req: Request) {)const { error: storageError } = await supabaseAdminClient.storage.from('images')- .upload(`lw7/tickets/gallery/${username}.png`, generatedImage.body!, {- contentType: 'image/png',- // cacheControl: '31536000',- upsert: true,- })+ .upload(+ `lw7/tickets/gallery/${golden ? 'golden' : 'regular'}/v1/${username}.png`,+ generatedImage.body!,+ {+ contentType: 'image/png',+ // cacheControl: '31536000',+ upsert: true,+ }+ )if (storageError) throw new Error(`storageError: ${storageError.message}`)return new Response(JSON.stringify({ success: true }), {diff --git a/apps/www/supabase/functions/lw7-ticket-og/handler.tsx b/apps/www/supabase/functions/lw7-ticket-og/handler.tsxindex 6f5a47a0086..3d2b32a4df7 100644--- a/apps/www/supabase/functions/lw7-ticket-og/handler.tsx+++ b/apps/www/supabase/functions/lw7-ticket-og/handler.tsx@@ -42,9 +42,9 @@ export async function handler(req: Request) {// Try to get image from Supabase Storage CDN.let storageResponse: Response- storageResponse = await fetch(`${STORAGE_URL}/tickets/golden/${username}.png`)+ storageResponse = await fetch(`${STORAGE_URL}/tickets/golden/v1/${username}.png`)if (storageResponse.ok) return storageResponse- storageResponse = await fetch(`${STORAGE_URL}/tickets/${username}.png`)+ storageResponse = await fetch(`${STORAGE_URL}/tickets/regular/v1/${username}.png`)if (!assumeGolden && storageResponse.ok) return storageResponse// Get ticket data@@ -64,12 +64,12 @@ export async function handler(req: Request) {const BACKGROUND = {REG: {BG: `${STORAGE_URL}/reg_bg.png`,- AI: `${STORAGE_URL}/tickets_bg/reg_bg_${bg_image_id}.png`,+ AI: `${STORAGE_URL}/tickets_bg/blurred/regular/png/reg_bg_${bg_image_id}.png`,TICKET: `${STORAGE_URL}/reg_ticket.png`,},GOLD: {BG: `${STORAGE_URL}/gold_bg.png`,- AI: `${STORAGE_URL}/tickets_bg/golden/gold_bg_${bg_image_id}.png`,+ AI: `${STORAGE_URL}/tickets_bg/blurred/golden/png/gold_bg_${bg_image_id}.png`,TICKET: `${STORAGE_URL}/gold_ticket.png`,},}@@ -146,7 +146,6 @@ export async function handler(req: Request) {{/* Name & username */}<divstyle={{- // border: '3px solid red',display: 'flex',alignItems: 'center',justifyContent: 'center',@@ -163,7 +162,6 @@ export async function handler(req: Request) {><divstyle={{- // border: '3px solid green',display: 'flex',color: 'transparent',backgroundImage:@@ -185,7 +183,6 @@ export async function handler(req: Request) {{/* Username */}<divstyle={{- // border: '3px solid blue',/color: '#EDEDED',opacity: 0.8,display: 'flex',@@ -200,7 +197,6 @@ export async function handler(req: Request) {{/* Ticket No */}<divstyle={{- // border: '3px solid red',color: '#F8F9FA',display: 'flex',alignItems: 'center',@@ -245,13 +241,17 @@ export async function handler(req: Request) {// Upload image to storage.const { error: storageError } = await supabaseAdminClient.storage.from('images')- .upload(`lw7/tickets/${golden ? `golden/${username}` : username}.png`, generatedImage.body!, {- contentType: 'image/png',- // cacheControl: '31536000',- upsert: false,- })+ .upload(+ `lw7/tickets/${golden ? 'golden' : 'regular'}/v1/${username}.png`,+ generatedImage.body!,+ {+ contentType: 'image/png',+ // cacheControl: '31536000',+ upsert: false,+ }+ )if (storageError) throw new Error(`storageError: ${storageError.message}`)- // Generate imgae for gallery+ // Generate image for galleryfetch('https://obuldanrptloktxcffvn.functions.supabase.in/lw7-ticket-gallery', {method: 'POST',headers: {@@ -268,7 +268,7 @@ export async function handler(req: Request) {}),})- return await fetch(`${STORAGE_URL}/tickets/${golden ? `golden/${username}` : username}.png`)+ return await fetch(`${STORAGE_URL}/tickets/${golden ? 'golden' : 'regular'}/v1/${username}.png`)} catch (error) {return new Response(JSON.stringify({ error: error.message }), {headers: { ...corsHeaders, 'Content-Type': 'application/json' },