@@ -15,6 +15,8 @@ import { Input } from '@/components/ui/input'
15
15
import { OTPInputForm } from '@/components/ui/input-otp-form'
16
16
import { ScrollArea } from '@/components/ui/scroll-area'
17
17
import { cn } from '@/lib/utils'
18
+ import { getFormattedGitHubStars } from '@/app/(landing)/actions/github'
19
+ import HeaderLinks from './components/header-links/header-links'
18
20
import MarkdownRenderer from './components/markdown-renderer/markdown-renderer'
19
21
20
22
// Define message type
@@ -96,6 +98,7 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
96
98
const messagesEndRef = useRef < HTMLDivElement > ( null )
97
99
const messagesContainerRef = useRef < HTMLDivElement > ( null )
98
100
const inputRef = useRef < HTMLInputElement > ( null )
101
+ const [ starCount , setStarCount ] = useState ( '3.4k' )
99
102
100
103
// Authentication state
101
104
const [ authRequired , setAuthRequired ] = useState < 'password' | 'email' | null > ( null )
@@ -163,6 +166,15 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
163
166
// Fetch chat config on mount
164
167
useEffect ( ( ) => {
165
168
fetchChatConfig ( )
169
+
170
+ // Fetch GitHub stars
171
+ getFormattedGitHubStars ( )
172
+ . then ( ( formattedStars ) => {
173
+ setStarCount ( formattedStars )
174
+ } )
175
+ . catch ( ( err ) => {
176
+ console . error ( 'Failed to fetch GitHub stars:' , err )
177
+ } )
166
178
} , [ subdomain ] )
167
179
168
180
// Handle keyboard input for message sending
@@ -514,6 +526,49 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
514
526
return (
515
527
< div className = "flex items-center justify-center min-h-screen bg-gray-50" >
516
528
< div className = "p-6 max-w-md mx-auto bg-white rounded-xl shadow-md" >
529
+ < div className = "flex justify-between items-center mb-2" >
530
+ < a href = "https://simstudio.ai" target = "_blank" rel = "noopener noreferrer" >
531
+ < svg
532
+ width = "32"
533
+ height = "32"
534
+ viewBox = "0 0 50 50"
535
+ fill = "none"
536
+ xmlns = "http://www.w3.org/2000/svg"
537
+ className = "rounded-[6px]"
538
+ >
539
+ < rect width = "50" height = "50" fill = "#701FFC" />
540
+ < path
541
+ d = "M34.1455 20.0728H16.0364C12.7026 20.0728 10 22.7753 10 26.1091V35.1637C10 38.4975 12.7026 41.2 16.0364 41.2H34.1455C37.4792 41.2 40.1818 38.4975 40.1818 35.1637V26.1091C40.1818 22.7753 37.4792 20.0728 34.1455 20.0728Z"
542
+ fill = "#701FFC"
543
+ stroke = "white"
544
+ strokeWidth = "3.5"
545
+ strokeLinecap = "round"
546
+ strokeLinejoin = "round"
547
+ />
548
+ < path
549
+ d = "M25.0919 14.0364C26.7588 14.0364 28.1101 12.6851 28.1101 11.0182C28.1101 9.35129 26.7588 8 25.0919 8C23.425 8 22.0737 9.35129 22.0737 11.0182C22.0737 12.6851 23.425 14.0364 25.0919 14.0364Z"
550
+ fill = "#701FFC"
551
+ stroke = "white"
552
+ strokeWidth = "4"
553
+ strokeLinecap = "round"
554
+ strokeLinejoin = "round"
555
+ />
556
+ < path
557
+ d = "M25.0915 14.856V19.0277V14.856ZM20.5645 32.1398V29.1216V32.1398ZM29.619 29.1216V32.1398V29.1216Z"
558
+ fill = "#701FFC"
559
+ />
560
+ < path
561
+ d = "M25.0915 14.856V19.0277M20.5645 32.1398V29.1216M29.619 29.1216V32.1398"
562
+ stroke = "white"
563
+ strokeWidth = "4"
564
+ strokeLinecap = "round"
565
+ strokeLinejoin = "round"
566
+ />
567
+ < circle cx = "25" cy = "11" r = "2" fill = "#701FFC" />
568
+ </ svg >
569
+ </ a >
570
+ < HeaderLinks stars = { starCount } />
571
+ </ div >
517
572
< h2 className = "text-xl font-bold text-red-500 mb-2" > Error</ h2 >
518
573
< p className = "text-gray-700" > { error } </ p >
519
574
</ div >
@@ -530,6 +585,49 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
530
585
return (
531
586
< div className = "flex items-center justify-center min-h-screen bg-gray-50" >
532
587
< div className = "p-6 max-w-md w-full mx-auto bg-white rounded-xl shadow-md" >
588
+ < div className = "flex justify-between items-center w-full mb-4" >
589
+ < a href = "https://simstudio.ai" target = "_blank" rel = "noopener noreferrer" >
590
+ < svg
591
+ width = "32"
592
+ height = "32"
593
+ viewBox = "0 0 50 50"
594
+ fill = "none"
595
+ xmlns = "http://www.w3.org/2000/svg"
596
+ className = "rounded-[6px]"
597
+ >
598
+ < rect width = "50" height = "50" fill = "#701FFC" />
599
+ < path
600
+ d = "M34.1455 20.0728H16.0364C12.7026 20.0728 10 22.7753 10 26.1091V35.1637C10 38.4975 12.7026 41.2 16.0364 41.2H34.1455C37.4792 41.2 40.1818 38.4975 40.1818 35.1637V26.1091C40.1818 22.7753 37.4792 20.0728 34.1455 20.0728Z"
601
+ fill = "#701FFC"
602
+ stroke = "white"
603
+ strokeWidth = "3.5"
604
+ strokeLinecap = "round"
605
+ strokeLinejoin = "round"
606
+ />
607
+ < path
608
+ d = "M25.0919 14.0364C26.7588 14.0364 28.1101 12.6851 28.1101 11.0182C28.1101 9.35129 26.7588 8 25.0919 8C23.425 8 22.0737 9.35129 22.0737 11.0182C22.0737 12.6851 23.425 14.0364 25.0919 14.0364Z"
609
+ fill = "#701FFC"
610
+ stroke = "white"
611
+ strokeWidth = "4"
612
+ strokeLinecap = "round"
613
+ strokeLinejoin = "round"
614
+ />
615
+ < path
616
+ d = "M25.0915 14.856V19.0277V14.856ZM20.5645 32.1398V29.1216V32.1398ZM29.619 29.1216V32.1398V29.1216Z"
617
+ fill = "#701FFC"
618
+ />
619
+ < path
620
+ d = "M25.0915 14.856V19.0277M20.5645 32.1398V29.1216M29.619 29.1216V32.1398"
621
+ stroke = "white"
622
+ strokeWidth = "4"
623
+ strokeLinecap = "round"
624
+ strokeLinejoin = "round"
625
+ />
626
+ < circle cx = "25" cy = "11" r = "2" fill = "#701FFC" />
627
+ </ svg >
628
+ </ a >
629
+ < HeaderLinks stars = { starCount } />
630
+ </ div >
533
631
< div className = "text-center mb-6" >
534
632
< h2 className = "text-xl font-bold mb-2" > { title } </ h2 >
535
633
< p className = "text-gray-600" >
@@ -744,18 +842,65 @@ export default function ChatClient({ subdomain }: { subdomain: string }) {
744
842
}
745
843
` } </ style >
746
844
747
- { /* Header with title */ }
748
- < div className = "flex items-center justify-between px-4 py-3" >
749
- < h2 className = "text-lg font-medium" >
750
- { chatConfig . customizations ?. headerText || chatConfig . title || 'Chat' }
751
- </ h2 >
752
- { chatConfig . customizations ?. logoUrl && (
753
- < img
754
- src = { chatConfig . customizations . logoUrl }
755
- alt = { `${ chatConfig . title } logo` }
756
- className = "h-6 w-6 object-contain"
757
- />
758
- ) }
845
+ { /* Header with title and links */ }
846
+ < div className = "flex items-center justify-between px-6 py-4" >
847
+ < div className = "flex items-center gap-2" >
848
+ { chatConfig ?. customizations ?. logoUrl && (
849
+ < img
850
+ src = { chatConfig . customizations . logoUrl }
851
+ alt = { `${ chatConfig ?. title || 'Chat' } logo` }
852
+ className = "h-6 w-6 object-contain"
853
+ />
854
+ ) }
855
+ < h2 className = "text-lg font-medium" >
856
+ { chatConfig ?. customizations ?. headerText || chatConfig ?. title || 'Chat' }
857
+ </ h2 >
858
+ </ div >
859
+ < div className = "flex items-center gap-3" >
860
+ < HeaderLinks stars = { starCount } />
861
+ { ! chatConfig ?. customizations ?. logoUrl && (
862
+ < a href = "https://simstudio.ai" target = "_blank" rel = "noopener noreferrer" >
863
+ < svg
864
+ width = "32"
865
+ height = "32"
866
+ viewBox = "0 0 50 50"
867
+ fill = "none"
868
+ xmlns = "http://www.w3.org/2000/svg"
869
+ className = "rounded-[6px]"
870
+ >
871
+ < rect width = "50" height = "50" fill = "#701FFC" />
872
+ < path
873
+ d = "M34.1455 20.0728H16.0364C12.7026 20.0728 10 22.7753 10 26.1091V35.1637C10 38.4975 12.7026 41.2 16.0364 41.2H34.1455C37.4792 41.2 40.1818 38.4975 40.1818 35.1637V26.1091C40.1818 22.7753 37.4792 20.0728 34.1455 20.0728Z"
874
+ fill = "#701FFC"
875
+ stroke = "white"
876
+ strokeWidth = "3.5"
877
+ strokeLinecap = "round"
878
+ strokeLinejoin = "round"
879
+ />
880
+ < path
881
+ d = "M25.0919 14.0364C26.7588 14.0364 28.1101 12.6851 28.1101 11.0182C28.1101 9.35129 26.7588 8 25.0919 8C23.425 8 22.0737 9.35129 22.0737 11.0182C22.0737 12.6851 23.425 14.0364 25.0919 14.0364Z"
882
+ fill = "#701FFC"
883
+ stroke = "white"
884
+ strokeWidth = "4"
885
+ strokeLinecap = "round"
886
+ strokeLinejoin = "round"
887
+ />
888
+ < path
889
+ d = "M25.0915 14.856V19.0277V14.856ZM20.5645 32.1398V29.1216V32.1398ZM29.619 29.1216V32.1398V29.1216Z"
890
+ fill = "#701FFC"
891
+ />
892
+ < path
893
+ d = "M25.0915 14.856V19.0277M20.5645 32.1398V29.1216M29.619 29.1216V32.1398"
894
+ stroke = "white"
895
+ strokeWidth = "4"
896
+ strokeLinecap = "round"
897
+ strokeLinejoin = "round"
898
+ />
899
+ < circle cx = "25" cy = "11" r = "2" fill = "#701FFC" />
900
+ </ svg >
901
+ </ a >
902
+ ) }
903
+ </ div >
759
904
</ div >
760
905
761
906
{ /* Messages container */ }
0 commit comments