11import type React from "react" ;
22import type { MetaFunction } from "react-router" ;
33
4- import { Link , useLoaderData } from "react-router" ;
4+ import { Link , useLoaderData , useOutletContext } from "react-router" ;
55import { parseISO , format } from "date-fns" ;
66import { ptBR } from "date-fns/locale" ;
77
@@ -25,6 +25,7 @@ import { RiLiveLine } from "react-icons/ri";
2525import { cn } from "~/lib/utils/cn" ;
2626import { useState } from "react" ;
2727import ProSpanWrapper from "~/components/ui/pro-span-wrapper" ;
28+ import type { User } from "~/lib/models/user.server" ;
2829
2930export const meta : MetaFunction = ( ) => {
3031 return [
@@ -67,6 +68,7 @@ function getBorderColor(type: string) {
6768
6869export default function Calendar ( ) {
6970 const events = useLoaderData < typeof loader > ( ) ;
71+ const { user } = useOutletContext < { user : User | null } > ( ) ;
7072
7173 const [ selectedFilter , setSelectedFilter ] = useState < "upcoming" | "previous" > (
7274 "upcoming" ,
@@ -254,33 +256,35 @@ export default function Calendar() {
254256 ) ) }
255257 </ div >
256258 </ div >
257- < div className = "xl:w-1/3 w-full hidden xl:block" >
258- < Link to = "/planos" className = "sticky top-20" >
259- < Card
260- border = "default"
261- className = "w-full text-sm rounded-lg overflow-hidden bg-grainy mt-32"
262- >
263- < CardHeader >
264- < CardTitle className = "md:text-md lg:text-lg xl:text-lg text-xs" >
265- < span className = "font-medium text-gray-700 dark:text-gray-50" >
266- Conheça o Codante < ProSpanWrapper > PRO</ ProSpanWrapper >
267- </ span >
268- </ CardTitle >
269- </ CardHeader >
270- < CardContent className = "text-sm text-gray-700 dark:text-gray-300" >
271- < p >
272- Tenha acesso completo a todos os nossos Mini Projetos e
273- Workshops.
274- </ p >
275- < img
276- src = "/img/agenda-promo.webp"
277- alt = "Codante Pro"
278- className = "w-full"
279- />
280- </ CardContent >
281- </ Card >
282- </ Link >
283- </ div >
259+ { ( ! user || ! user . is_pro ) && (
260+ < div className = "xl:w-1/3 w-full hidden xl:block" >
261+ < Link to = "/planos" className = "sticky top-20" >
262+ < Card
263+ border = "default"
264+ className = "w-full text-sm rounded-lg overflow-hidden bg-grainy mt-32"
265+ >
266+ < CardHeader >
267+ < CardTitle className = "md:text-md lg:text-lg xl:text-lg text-xs" >
268+ < span className = "font-medium text-gray-700 dark:text-gray-50" >
269+ Conheça o Codante < ProSpanWrapper > PRO</ ProSpanWrapper >
270+ </ span >
271+ </ CardTitle >
272+ </ CardHeader >
273+ < CardContent className = "text-sm text-gray-700 dark:text-gray-300" >
274+ < p >
275+ Tenha acesso completo a todos os nossos Mini Projetos e
276+ Workshops.
277+ </ p >
278+ < img
279+ src = "/img/agenda-promo.webp"
280+ alt = "Codante Pro"
281+ className = "w-full"
282+ />
283+ </ CardContent >
284+ </ Card >
285+ </ Link >
286+ </ div >
287+ ) }
284288 </ div >
285289 ) ;
286290}
0 commit comments