File tree 2 files changed +46
-9
lines changed
app/(app)/(questions)/question/[slug]
components/app/questions/layout
2 files changed +46
-9
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,28 @@ import { getRandomQuestion } from '@/utils/data/questions/get-random';
10
10
import ExpandedCodeModal from '@/components/app/questions/expanded-code-modal' ;
11
11
import RelatedQuestions from '@/components/app/questions/single/related-question-card' ;
12
12
import ResizableLayout from '@/components/ui/resizable-layout' ;
13
+ import { capitalise , createMetadata } from '@/utils' ;
14
+
15
+ export async function generateMetadata ( {
16
+ params,
17
+ } : {
18
+ params : { slug : string } ;
19
+ } ) {
20
+ const question = await getQuestion ( 'slug' , params . slug ) ;
21
+ // get the title via slug and removing the - from the slug
22
+ const title = question ?. slug ?. replace ( / - / g, ' ' ) || 'Coding Question' ;
23
+
24
+ return createMetadata ( {
25
+ title : `${ capitalise ( title ) } | TechBlitz` ,
26
+ description : 'Boost your coding skills for free with TechBlitz' ,
27
+ image : {
28
+ text : `${ title } | TechBlitz` ,
29
+ bgColor : '#000000' ,
30
+ textColor : '#ffffff' ,
31
+ } ,
32
+ canonicalUrl : `/question/${ params . slug } ` ,
33
+ } ) ;
34
+ }
13
35
14
36
export default async function TodaysQuestionPage ( {
15
37
params,
Original file line number Diff line number Diff line change @@ -49,15 +49,30 @@ export default async function QuestionPageSidebar(opts: {
49
49
/>
50
50
< Separator className = "w-full bg-black-50" />
51
51
< div className = "grid grid-cols-2 gap-4 pt-2" >
52
- < div className = "flex flex-col gap-y-2 items-center" >
53
- < p className = "text-sm text-gray-400" > Longest streak</ p >
54
- < div className = "flex items-center gap-x-1" >
55
- < p className = "font-onest font-bold" >
56
- { userStreak ?. streakData ?. longestStreak }
57
- </ p >
58
- < SolarFlameBoldDuotone className = "size-6" />
59
- </ div >
60
- </ div >
52
+ < TooltipProvider >
53
+ < Tooltip delayDuration = { 100 } >
54
+ < TooltipTrigger >
55
+ < div className = "flex flex-col gap-y-2 items-center" >
56
+ < p className = "text-sm text-gray-400" >
57
+ Longest streak
58
+ </ p >
59
+ < div className = "flex items-center gap-x-1" >
60
+ < p className = "font-onest font-bold" >
61
+ { userStreak ?. streakData ?. longestStreak }
62
+ </ p >
63
+ < SolarFlameBoldDuotone className = "size-6" />
64
+ </ div >
65
+ </ div >
66
+ </ TooltipTrigger >
67
+ < TooltipContent >
68
+ < p >
69
+ Your longest streak was{ ' ' }
70
+ { userStreak ?. streakData ?. longestStreak } days.
71
+ </ p >
72
+ </ TooltipContent >
73
+ </ Tooltip >
74
+ </ TooltipProvider >
75
+
61
76
< div className = "flex flex-col gap-y-2 items-center" >
62
77
< p className = "text-sm text-gray-400" > Current streak</ p >
63
78
< CurrentStreak />
You can’t perform that action at this time.
0 commit comments