@@ -5,6 +5,7 @@ import { useRouter } from 'next/navigation';
55import { LiaPencilRulerSolid } from "react-icons/lia" ;
66import classNames from "classnames" ;
77import { GoArrowUpRight } from "react-icons/go" ;
8+ import Spinner from '../Spinner' ;
89
910const shortcutIdeas = [
1011 {
@@ -41,6 +42,9 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
4142 getInputProps,
4243 open,
4344 } = useContext ( UploadFileContext ) ;
45+
46+ const [ loading , setLoading ] = useState < boolean > ( false ) ;
47+
4448 const { initCreateText, setInitCreateText, setInitCreate } = useContext ( SettingContext ) ;
4549 useEffect ( ( ) => {
4650 inputRef . current . focus ( ) ;
@@ -55,8 +59,10 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
5559
5660 const clickHandler = ( ) => {
5761 if ( initCreateText ) {
62+ setLoading ( true ) ;
5863 setInitCreate ( true ) ;
59- router . push ( '/editor' , { scroll : false } )
64+ router . push ( '/editor' , { scroll : false } ) ;
65+ setLoading ( false ) ;
6066 }
6167 }
6268
@@ -67,30 +73,6 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
6773 < div
6874 className = "absolute bottom-0 z-10 flex flex-col w-full"
6975 >
70- { /* <div className='w-full flex items-center justify-center p-6 gap-6'>
71- <div
72- onClick={open}
73- className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-pink-500 relative inline-block px-2'>
74- <span className='relative text-white'>screenshot</span>
75- </div>
76- <div
77- onClick={openWhiteboard}
78- className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-green-500 relative inline-block px-2'>
79- <span className='relative text-white'>whiteboard</span>
80- </div>
81- <div
82- onClick={() => {
83- inputRef.current.focus();
84- setShowAnim(true);
85- setTimeout(() => {
86- setShowAnim(false);
87- }, 800)
88- }}
89- className='cursor-pointer before:block before:absolute before:-inset-1 before:-skew-y-3 before:bg-cyan-500 relative inline-block px-8'
90- >
91- <span className='relative text-white'>ideas</span>
92- </div>
93- </div> */ }
9476 { /* animate-wiggle */ }
9577 < div
9678 className = { classNames (
@@ -141,16 +123,22 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
141123 < svg onClick = { open } viewBox = "0 0 16 16" fill = "none" xmlns = "http://www.w3.org/2000/svg" className = "w-4 h-4" > < g clipPath = "url(#a)" > < path fill = "currentColor" fillRule = "evenodd" d = "M14.5 2.5h-13v6.69l1.47-1.47.22-.22h3.75l.03-.03 3.5-3.5h1.06l2.97 2.97V2.5ZM8 8.56l1.53 1.53.53.53L9 11.68l-.53-.53L6.32 9H3.81l-2.28 2.28-.03.03v1.19a1 1 0 0 0 1 1h11a1 1 0 0 0 1-1V9.06L11 5.56 8.03 8.53 8 8.56Zm-8 2.25v1.69A2.5 2.5 0 0 0 2.5 15h11a2.5 2.5 0 0 0 2.5-2.5V9.56l.56-.56-.53-.53-.03-.03V1H0v9.69l-.06.06.06.06Z" clipRule = "evenodd" > </ path > </ g > < defs > < clipPath id = "a" > < path fill = "currentColor" d = "M0 0h16v16H0z" > </ path > </ clipPath > </ defs > </ svg >
142124 < span className = "sr-only" > Upload image</ span >
143125 </ label >
144- < button
145- className = "shrink-0 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-transparent text-white hover:bg-gray-800 flex items-center justify-center focus-visible:ring-0 focus-visible:bg-gray-800 rounded-full w-[28px] h-[28px]"
146- id = "send-button"
147- onClick = { clickHandler }
148- >
149- < span className = "sr-only" > Send</ span >
150- < svg width = "16" height = "16" viewBox = "0 0 16 16" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
151- < path fillRule = "evenodd" clipRule = "evenodd" d = "M13.5 3V2.25H15V3V10C15 10.5523 14.5522 11 14 11H3.56062L5.53029 12.9697L6.06062 13.5L4.99996 14.5607L4.46963 14.0303L1.39641 10.9571C1.00588 10.5666 1.00588 9.93342 1.39641 9.54289L4.46963 6.46967L4.99996 5.93934L6.06062 7L5.53029 7.53033L3.56062 9.5H13.5V3Z" fill = "currentColor" > </ path >
152- </ svg >
153- </ button >
126+ { loading ? (
127+ < button className = 'w-[28px] h-[28px] scale-75' >
128+ < Spinner />
129+ </ button >
130+ ) : (
131+ < button
132+ className = "shrink-0 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 bg-transparent text-white hover:bg-gray-800 flex items-center justify-center focus-visible:ring-0 focus-visible:bg-gray-800 rounded-full w-[28px] h-[28px]"
133+ id = "send-button"
134+ onClick = { clickHandler }
135+ >
136+ < span className = "sr-only" > Send</ span >
137+ < svg width = "16" height = "16" viewBox = "0 0 16 16" fill = "none" xmlns = "http://www.w3.org/2000/svg" >
138+ < path fillRule = "evenodd" clipRule = "evenodd" d = "M13.5 3V2.25H15V3V10C15 10.5523 14.5522 11 14 11H3.56062L5.53029 12.9697L6.06062 13.5L4.99996 14.5607L4.46963 14.0303L1.39641 10.9571C1.00588 10.5666 1.00588 9.93342 1.39641 9.54289L4.46963 6.46967L4.99996 5.93934L6.06062 7L5.53029 7.53033L3.56062 9.5H13.5V3Z" fill = "currentColor" > </ path >
139+ </ svg >
140+ </ button >
141+ ) }
154142 </ div >
155143 </ div >
156144 </ div >
@@ -160,7 +148,7 @@ export default function ChatInput({openWhiteboard, showAnim}: props) {
160148 return (
161149 < button
162150 key = { shortcut . id }
163- className = 'rounded-full border border-zinc-200 px-2 py-0.5 inline-flex gap-1 items-center whitespace-nowrap select-none hover:border-zinc-800 transition-colors'
151+ className = 'text-slate-400 text-sm rounded-full border border-zinc-200 px-2 py-0.5 inline-flex gap-1 items-center whitespace-nowrap select-none hover:border-zinc-800 transition-colors'
164152 onClick = { ( ) => {
165153 setInitCreateText ( shortcut . value ) ;
166154 } }
0 commit comments