33import type { userSelectProps } from "@cap/database/auth/session" ;
44import type { videos } from "@cap/database/schema" ;
55import { buildEnv , NODE_ENV } from "@cap/env" ;
6- import { Avatar , Button } from "@cap/ui" ;
6+ import { Button } from "@cap/ui" ;
77import { userIsPro } from "@cap/utils" ;
88import { faChevronDown , faLock } from "@fortawesome/free-solid-svg-icons" ;
99import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
1010import clsx from "clsx" ;
1111import { Check , Copy , Globe2 } from "lucide-react" ;
1212import moment from "moment" ;
13- import Image from "next/image" ;
1413import { useRouter } from "next/navigation" ;
1514import { useEffect , useState } from "react" ;
1615import { toast } from "sonner" ;
@@ -30,10 +29,7 @@ export const ShareHeader = ({
3029 sharedSpaces = [ ] ,
3130 spacesData = null ,
3231} : {
33- data : typeof videos . $inferSelect & {
34- organizationIconUrl ?: string | null ;
35- organizationName ?: string | null ;
36- } ;
32+ data : typeof videos . $inferSelect ;
3733 user : typeof userSelectProps | null ;
3834 customDomain ?: string | null ;
3935 domainVerified ?: boolean ;
@@ -74,11 +70,9 @@ export const ShareHeader = ({
7470
7571 const handleBlur = async ( ) => {
7672 setIsEditing ( false ) ;
77- const next = title . trim ( ) ;
78- if ( next === "" || next === data . name ) return ;
73+
7974 try {
80- await editTitle ( data . id , next ) ;
81- setTitle ( next ) ;
75+ await editTitle ( data . id , title ) ;
8276 toast . success ( "Video title updated" ) ;
8377 refresh ( ) ;
8478 } catch ( error ) {
@@ -87,7 +81,6 @@ export const ShareHeader = ({
8781 } else {
8882 toast . error ( "Failed to update title - please try again." ) ;
8983 }
90- setTitle ( data . name ) ;
9184 }
9285 } ;
9386
@@ -143,7 +136,7 @@ export const ShareHeader = ({
143136
144137 const renderSharedStatus = ( ) => {
145138 const baseClassName =
146- "text-sm text-gray-10 justify-center lg:justify-start transition-colors duration-200 flex items-center" ;
139+ "text-sm text-gray-10 transition-colors duration-200 flex items-center" ;
147140
148141 if ( isOwner ) {
149142 const hasSpaceSharing =
@@ -205,37 +198,17 @@ export const ShareHeader = ({
205198 />
206199 < div className = "mt-8" >
207200 < div className = "flex flex-col gap-6 lg:flex-row lg:items-center lg:justify-between lg:gap-0" >
208- < div className = "justify-center items-center mb-3 w-full md:flex lg:justify-between md:space-x-6 md:mb-0" >
209- < div className = "flex flex-col gap-5 md:gap-10 lg:flex-row" >
210- < div className = "flex flex-col flex-1 justify-center items-center w-full lg:justify-evenly" >
211- { data . organizationIconUrl ? (
212- < Image
213- className = "rounded-full size-9"
214- src = { data . organizationIconUrl }
215- alt = "Organization icon"
216- width = { 36 }
217- height = { 36 }
218- />
219- ) : (
220- < Avatar
221- className = "rounded-full size-9"
222- name = { data . organizationName ?? "Organization" }
223- letterClass = "text-sm"
224- />
225- ) }
226- < p className = "text-sm font-medium text-gray-12" >
227- { data . organizationName }
228- </ p >
229- </ div >
230- < div className = "flex flex-col justify-center text-center lg:text-left lg:justify-start" >
201+ < div className = "items-center md:flex md:justify-between md:space-x-6" >
202+ < div className = "mb-3 md:mb-0" >
203+ < div className = "flex items-center space-x-3 lg:min-w-[400px]" >
231204 { isEditing ? (
232205 < input
233206 value = { title }
234207 onChange = { ( e ) => setTitle ( e . target . value ) }
235208 onBlur = { handleBlur }
236209 onKeyDown = { handleKeyDown }
237210 autoFocus
238- className = "w-full text-xl sm:text-2xl"
211+ className = "w-full text-xl font-semibold sm:text-2xl"
239212 />
240213 ) : (
241214 < h1
@@ -249,16 +222,16 @@ export const ShareHeader = ({
249222 { title }
250223 </ h1 >
251224 ) }
252- { user && renderSharedStatus ( ) }
253- < p className = "mt-1 text-sm text-gray-10" >
254- { moment ( data . createdAt ) . fromNow ( ) }
255- </ p >
256225 </ div >
226+ { user && renderSharedStatus ( ) }
227+ < p className = "mt-1 text-sm text-gray-10" >
228+ { moment ( data . createdAt ) . fromNow ( ) }
229+ </ p >
257230 </ div >
258231 </ div >
259232 { user !== null && (
260- < div className = "flex justify-center space-x-2 w-full lg:justify-end " >
261- < div className = "w-fit" >
233+ < div className = "flex space-x-2" >
234+ < div >
262235 < div className = "flex gap-2 items-center" >
263236 { data . password && (
264237 < FontAwesomeIcon
0 commit comments