@@ -49,11 +49,7 @@ const DetailsQuery: any = graphql(`
4949 }
5050` ) ;
5151
52- interface DetailsProps {
53- setShowcharts : ( vars : boolean ) => void ;
54- }
55-
56- const Details : React . FC < DetailsProps > = ( { setShowcharts } ) => {
52+ const Details : React . FC = ( ) => {
5753 const params = useParams ( ) ;
5854 const chartRef = useRef < ReactECharts > ( null ) ;
5955
@@ -62,12 +58,6 @@ const Details: React.FC<DetailsProps> = ({ setShowcharts }) => {
6258 ( ) => GraphQL ( DetailsQuery , { } , { datasetId : params . datasetIdentifier } )
6359 ) ;
6460
65- useEffect ( ( ) => {
66- if ( data && data ?. getChartData . length <= 0 ) {
67- setShowcharts ( false ) ;
68- }
69- } , [ data ] ) ;
70-
7161 const renderChart = ( item : any ) => {
7262 if ( item . chartType === 'ASSAM_DISTRICT' || item . chartType === 'ASSAM_RC' ) {
7363 // Register the map
@@ -84,35 +74,20 @@ const Details: React.FC<DetailsProps> = ({ setShowcharts }) => {
8474 const toggleDescription = ( ) => setIsexpanded ( ! isexpanded ) ;
8575
8676 return (
87- < div className = " flex w-full flex-col gap-4 p-2" >
77+ < >
8878 { isLoading ? (
8979 < div className = " mt-8 flex justify-center" >
9080 < Spinner />
9181 </ div >
9282 ) : data ?. getChartData ?. length > 0 ? (
93- < >
83+ < div className = " flex w-full flex-col gap-4 py-10" >
9484 < div className = "relative w-full " >
9585 < Carousel className = "w-full" >
9686 < div className = " px-12" >
9787 < CarouselContent className = "flex-grow" >
9888 { data ?. getChartData . map ( ( item : any , index : any ) => (
9989 < CarouselItem key = { index } className = "m-auto" >
10090 < div className = "w-full border-2 border-solid border-baseGraySlateSolid4 bg-surfaceDefault p-6 text-center shadow-basicLg max-sm:p-2" >
101- < div className = "lg:p-10" >
102- { item . __typename === 'TypeResourceChart' &&
103- item ?. chart ?. options ? (
104- renderChart ( item )
105- ) : (
106- < Image
107- src = { `${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/download/chart_image/${ item . id } ` }
108- alt = { '' }
109- width = { 300 }
110- height = { 300 }
111- unoptimized
112- />
113- ) }
114- { /* Call the renderChart function */ }
115- </ div >
11691 < div className = "flex items-center justify-between gap-2 max-sm:flex-wrap" >
11792 < div className = "flex flex-col gap-1 py-2 text-start" >
11893 < Text className = "font-semi-bold" > { item . name } </ Text >
@@ -133,13 +108,6 @@ const Details: React.FC<DetailsProps> = ({ setShowcharts }) => {
133108 </ Text >
134109 </ div >
135110 < div className = "flex gap-2" >
136- < Button kind = "secondary" className = "p-2" >
137- < Icon
138- source = { Icons . diagonal }
139- size = { 20 }
140- color = "default"
141- />
142- </ Button >
143111 < Link
144112 href = { `${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/download/chart/${ item . id } ` }
145113 target = "_blank"
@@ -155,6 +123,22 @@ const Details: React.FC<DetailsProps> = ({ setShowcharts }) => {
155123 </ Link >
156124 </ div >
157125 </ div >
126+ < div className = "p-4 lg:p-10" >
127+ { item . __typename === 'TypeResourceChart' &&
128+ item ?. chart ?. options ? (
129+ renderChart ( item )
130+ ) : (
131+ < Image
132+ src = { `${ process . env . NEXT_PUBLIC_BACKEND_URL } /api/download/chart_image/${ item . id } ` }
133+ alt = { '' }
134+ width = { 100 }
135+ height = { 100 }
136+ unoptimized
137+ className = " h-full w-full object-contain"
138+ />
139+ ) }
140+ { /* Call the renderChart function */ }
141+ </ div >
158142 </ div >
159143 </ CarouselItem >
160144 ) ) }
@@ -168,11 +152,11 @@ const Details: React.FC<DetailsProps> = ({ setShowcharts }) => {
168152 </ div >
169153 </ Carousel >
170154 </ div >
171- </ >
155+ </ div >
172156 ) : (
173157 ''
174158 ) }
175- </ div >
159+ </ >
176160 ) ;
177161} ;
178162
0 commit comments