-
person
-
Sponsors:
+const onFollowClick = () => {
+ // TODO implement follow here when backend is available
+}
+
+const updateSiteIsPublic = async (_: boolean) => {
+ // TODO Implement site update when backend is ready
+}
+const SiteSummaryCard = ({ site, viewMode }: Props) => {
+ const { t } = useTranslation()
+ const [isPublic, setIsPublic] = useState(true)
+
+ useEffect(() => void updateSiteIsPublic(isPublic), [isPublic])
+
+ return (
+
+
+
+ {/* TODO: replace img source when backend offers an image endpoint */}
+
+
+
+
+
+
{site.name}
+ {viewMode === 'user' && (
+
+ )}
+ {viewMode === 'admin' && (
+
+ )}
-
- {site.sponsors.map(sponsorName => (
-
{sponsorName}
- ))}
+
+
{site.description ?? ''}
+
+
+ person
+ {t('mapSite.siteSummaryCard.sponsors')}:
+
+
+ {site.sponsors.map(sponsorName => (
+
{sponsorName}
+ ))}
+
-
-)
+ )
+}
export default SiteSummaryCard
diff --git a/canopeum_frontend/src/locale/en/index.ts b/canopeum_frontend/src/locale/en/index.ts
index 828df9019..f995f17d8 100644
--- a/canopeum_frontend/src/locale/en/index.ts
+++ b/canopeum_frontend/src/locale/en/index.ts
@@ -1,10 +1,12 @@
import analyticsJSON from './analytics.json'
import homeJSON from './home.json'
+import mapSiteJSON from './mapSite.json'
const enJSON = {
translation: {
home: { ...homeJSON },
analytics: { ...analyticsJSON },
+ mapSite: { ...mapSiteJSON },
},
}
diff --git a/canopeum_frontend/src/locale/en/mapSite.json b/canopeum_frontend/src/locale/en/mapSite.json
new file mode 100644
index 000000000..1b1061934
--- /dev/null
+++ b/canopeum_frontend/src/locale/en/mapSite.json
@@ -0,0 +1,7 @@
+{
+ "siteSummaryCard": {
+ "follow": "Follow",
+ "sponsors": "Sponsors",
+ "public": "Public"
+ }
+}
diff --git a/canopeum_frontend/src/locale/fr/index.ts b/canopeum_frontend/src/locale/fr/index.ts
index dea64b48e..3bd6153ed 100644
--- a/canopeum_frontend/src/locale/fr/index.ts
+++ b/canopeum_frontend/src/locale/fr/index.ts
@@ -1,10 +1,12 @@
import analyticsJSON from './analytics.json'
import homeJSON from './home.json'
+import mapSiteJSON from './mapSite.json'
const frJSON = {
translation: {
home: { ...homeJSON },
analytics: { ...analyticsJSON },
+ mapSite: { ...mapSiteJSON },
},
}
diff --git a/canopeum_frontend/src/locale/fr/mapSite.json b/canopeum_frontend/src/locale/fr/mapSite.json
new file mode 100644
index 000000000..cf1924891
--- /dev/null
+++ b/canopeum_frontend/src/locale/fr/mapSite.json
@@ -0,0 +1,7 @@
+{
+ "siteSummaryCard": {
+ "follow": "Suivre",
+ "sponsors": "Commanditaires",
+ "public": "Publique"
+ }
+}
diff --git a/canopeum_frontend/src/pages/MapSite.tsx b/canopeum_frontend/src/pages/MapSite.tsx
index d8681a3e6..a577699be 100644
--- a/canopeum_frontend/src/pages/MapSite.tsx
+++ b/canopeum_frontend/src/pages/MapSite.tsx
@@ -1,15 +1,22 @@
+import { AuthenticationContext, UserRole } from '@components/context/AuthenticationContext'
import SiteSummaryCard from '@components/site/SiteSummaryCard'
import type { SiteSocial } from '@services/api'
import api from '@services/apiInterface'
import { ensureError } from '@services/errors'
-import { useEffect, useState } from 'react'
+import { useContext, useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
const MapSite = () => {
const { siteId } = useParams()
+ const { currentUser } = useContext(AuthenticationContext)
const [isLoadingSite, setIsLoadingSite] = useState(true)
const [error, setError] = useState
(undefined)
const [site, setSite] = useState()
+ const viewMode = currentUser
+ ? currentUser.role === UserRole.RegularUser
+ ? 'user'
+ : 'admin'
+ : 'visitor'
const fetchSiteData = async (parsedSiteId: number) => {
setIsLoadingSite(true)
@@ -41,7 +48,7 @@ const MapSite = () => {
{error.message}