SCGR commited on
Commit
a435246
·
1 Parent(s): 7fcc8e9
frontend/src/pages/ExplorePage/ExplorePage.tsx CHANGED
@@ -149,21 +149,6 @@ export default function ExplorePage() {
149
  });
150
  }, [captions, search, srcFilter, catFilter, regionFilter, countryFilter]);
151
 
152
- const toggleStarred = (imageId: string) => {
153
- setCaptions(prev => prev.map(c =>
154
- c.image_id === imageId ? { ...c, starred: !c.starred } : c
155
- ));
156
-
157
- fetch(`/api/images/${imageId}/caption`, {
158
- method: 'PUT',
159
- headers: { 'Content-Type': 'application/json' },
160
- body: JSON.stringify({ starred: !captions.find(c => c.image_id === imageId)?.starred })
161
- }).catch(() => {
162
- setCaptions(prev => prev.map(c =>
163
- c.image_id === imageId ? { ...c, starred: !c.starred } : c
164
- ));
165
- });
166
- };
167
 
168
  return (
169
  <PageContainer>
 
149
  });
150
  }, [captions, search, srcFilter, catFilter, regionFilter, countryFilter]);
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  return (
154
  <PageContainer>
frontend/src/pages/MapDetailsPage/MapDetailPage.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { PageContainer, Container, Button, Spinner, SegmentInput, IconButton, TextInput, SelectInput, MultiSelectInput } from '@ifrc-go/ui';
2
  import { useParams, useNavigate } from 'react-router-dom';
3
  import { useState, useEffect, useMemo } from 'react';
4
  import { ChevronLeftLineIcon, ChevronRightLineIcon } from '@ifrc-go/icons';
@@ -103,9 +103,8 @@ export default function MapDetailPage() {
103
  const images = await response.json();
104
  const currentIndex = images.findIndex((img: any) => img.image_id === currentId);
105
 
106
- // Always show navigation arrows since it's circular
107
- setHasPrevious(true);
108
- setHasNext(true);
109
  }
110
  } catch (error) {
111
  console.error('Failed to check navigation availability:', error);
 
1
+ import { PageContainer, Container, Button, Spinner, SegmentInput, TextInput, SelectInput, MultiSelectInput } from '@ifrc-go/ui';
2
  import { useParams, useNavigate } from 'react-router-dom';
3
  import { useState, useEffect, useMemo } from 'react';
4
  import { ChevronLeftLineIcon, ChevronRightLineIcon } from '@ifrc-go/icons';
 
103
  const images = await response.json();
104
  const currentIndex = images.findIndex((img: any) => img.image_id === currentId);
105
 
106
+ setHasPrevious(images.length > 1 && currentIndex > 0);
107
+ setHasNext(images.length > 1 && currentIndex < images.length - 1);
 
108
  }
109
  } catch (error) {
110
  console.error('Failed to check navigation availability:', error);