-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add location to user type * install leaflet packages * fix types * Add member map page and component * Add hacktoberfest 2023 badge * fix badge * style badges
- Loading branch information
1 parent
af8d32d
commit 176e28f
Showing
9 changed files
with
318 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import type { FixedUpUser, Location, MemberList } from 'members/types'; | ||
import { useEffect } from 'react'; | ||
import { MapContainer, Marker, TileLayer, Popup, useMap } from 'react-leaflet'; | ||
|
||
function Markers({ members }: { members: MemberList }) { | ||
const map = useMap(); | ||
|
||
useEffect(() => { | ||
const filtered = members.filter( | ||
(member): member is FixedUpUser & { location: Location } => { | ||
return !!(member && member.location); | ||
}, | ||
); | ||
|
||
map.fitBounds( | ||
filtered.map((member) => [ | ||
member.location.latitute, | ||
member.location.longitude, | ||
]), | ||
); | ||
}, [members, map]); | ||
|
||
return ( | ||
<> | ||
{members.map((member) => | ||
!member || | ||
!member.location?.latitute || | ||
!member.location?.longitude ? null : ( | ||
<Marker | ||
key={member.github} | ||
position={[member.location?.latitute, member.location?.longitude]} | ||
> | ||
<Popup> | ||
{member.name} | ||
{member.location?.title && ( | ||
<> | ||
{' - '} | ||
{member.location?.title} | ||
</> | ||
)} | ||
</Popup> | ||
</Marker> | ||
), | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default function MemberMap({ members }: { members: MemberList }) { | ||
return ( | ||
<div style={{ height: '50vh', position: 'relative' }}> | ||
<MapContainer | ||
center={[36.674222, -39.082187]} | ||
zoom={1} | ||
scrollWheelZoom={false} | ||
style={{ height: '50vh', position: 'relative' }} | ||
> | ||
<TileLayer | ||
attribution='© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' | ||
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" | ||
/> | ||
<Markers members={members} /> | ||
</MapContainer> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { json } from '@remix-run/node'; | ||
import { useLoaderData } from '@remix-run/react'; | ||
import DefaultLayout from '~/components/layouts/DefaultLayout'; | ||
|
||
import getMembers from '~/data/members'; | ||
import type { MembersResponse } from '~/data/members'; | ||
import { createMetaData } from '~/util/createMetaData.server'; | ||
import type { LinksFunction, LoaderArgs, MetaFunction } from '@remix-run/node'; | ||
import { type MemberList } from 'members/types'; | ||
|
||
import { lazy } from 'react'; | ||
import { ClientOnly } from 'remix-utils'; | ||
|
||
export const links: LinksFunction = () => [ | ||
{ | ||
rel: 'stylesheet', | ||
href: 'https://unpkg.com/[email protected]/dist/leaflet.css', | ||
crossOrigin: 'anonymous', | ||
integrity: 'sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=', | ||
}, | ||
]; | ||
|
||
let MapLoader = lazy(() => import('~/components/MemberMap')); | ||
|
||
export const loader = async (args: LoaderArgs) => { | ||
const { core, members }: MembersResponse = await getMembers(); | ||
|
||
const membersWithLocation: MemberList = [ | ||
...core.filter((member) => !!member?.location), | ||
...members.filter((member) => !!member?.location), | ||
]; | ||
|
||
const meta = createMetaData({ | ||
title: 'Virtual Coffee Members', | ||
description: 'Meet our amazing members!', | ||
Hero: 'UndrawTeamSpirit', | ||
}); | ||
|
||
return json({ members: membersWithLocation, meta }); | ||
}; | ||
|
||
export const meta: MetaFunction = ({ data: { meta } = {} }) => { | ||
return meta; | ||
}; | ||
|
||
export default function EventsIndex() { | ||
const { members } = useLoaderData<typeof loader>(); | ||
|
||
return ( | ||
<DefaultLayout | ||
Hero="UndrawTeamSpirit" | ||
heroHeader="Virtual Coffee Members" | ||
heroSubheader="A community is only as awesome as its members!" | ||
> | ||
<div className="bg-light py-5"> | ||
<div className="container-xl"> | ||
<ClientOnly>{() => <MapLoader members={members} />}</ClientOnly> | ||
</div> | ||
</div> | ||
</DefaultLayout> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
export function Hacktoberfest2023({ | ||
ariaHidden, | ||
title = 'Hacktoberfest 2023 Contributor', | ||
}: { | ||
ariaHidden?: boolean; | ||
title?: string; | ||
}) { | ||
return ( | ||
<svg | ||
width="24" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
style={{ | ||
fillRule: 'evenodd', | ||
clipRule: 'evenodd', | ||
strokeLinejoin: 'round', | ||
strokeMiterlimit: 2, | ||
}} | ||
{...(ariaHidden | ||
? { | ||
'aria-hidden': 'true', | ||
} | ||
: { | ||
role: 'img', | ||
'aria-labelledby': 'Hacktoberfest2023SvgTitle', | ||
})} | ||
> | ||
{!ariaHidden && <title id="Hacktoberfest2023SvgTitle">{title}</title>} | ||
<g> | ||
<path | ||
d="M3.833,20.574c-1.054,-0 -1.73,-0.716 -1.73,-1.79l-0,-4.456c-0,-1.112 -0.757,-1.725 -1.809,-1.768c-0.067,-0.003 -0.121,-0.056 -0.121,-0.123l0,-1.609c0,-0.067 0.054,-0.12 0.121,-0.123c1.052,-0.043 1.809,-0.655 1.809,-1.748l-0,-4.455c-0,-1.074 0.676,-1.791 1.73,-1.791l1.747,0c0.068,0 0.123,0.056 0.123,0.124l0,1.364c0,0.068 -0.055,0.124 -0.123,0.124l-1.404,-0c-0.069,-0 -0.124,0.055 -0.124,0.123l0,4.551c0,1.217 -0.806,2.265 -1.873,2.525c-0.056,0.014 -0.096,0.062 -0.096,0.12l-0,0.001c-0,0.058 0.04,0.107 0.096,0.12c1.067,0.26 1.873,1.308 1.873,2.525l0,4.551c0,0.068 0.055,0.124 0.124,0.124l1.404,-0c0.068,-0 0.123,0.055 0.123,0.123l0,1.364c0,0.068 -0.055,0.124 -0.123,0.124l-1.747,-0Z" | ||
fill="#2a2a2a" | ||
fillRule="nonzero" | ||
/> | ||
<path | ||
d="M20.106,2.711c1.054,0 1.77,0.717 1.77,1.791l-0,4.455c-0,1.093 0.757,1.705 1.809,1.748c0.067,0.003 0.12,0.056 0.12,0.123l0,1.609c0,0.067 -0.053,0.12 -0.12,0.123c-1.052,0.043 -1.809,0.656 -1.809,1.768l-0,4.456c-0,1.074 -0.716,1.79 -1.77,1.79l-1.747,-0c-0.068,-0 -0.123,-0.056 -0.123,-0.124l-0,-1.364c-0,-0.068 0.055,-0.123 0.123,-0.123l1.444,-0c0.068,-0 0.124,-0.056 0.124,-0.124l-0,-4.551c-0,-1.217 0.769,-2.266 1.871,-2.525c0.057,-0.014 0.098,-0.062 0.098,-0.12c-0,-0.058 -0.041,-0.107 -0.098,-0.121c-1.102,-0.259 -1.871,-1.307 -1.871,-2.525l-0,-4.551c-0,-0.068 -0.056,-0.123 -0.124,-0.123l-1.444,-0c-0.068,-0 -0.123,-0.056 -0.123,-0.124l-0,-1.364c-0,-0.068 0.055,-0.124 0.123,-0.124l1.747,0Z" | ||
fill="#2a2a2a" | ||
fillRule="nonzero" | ||
/> | ||
<g> | ||
<path | ||
d="M16.719,9.685c-1.351,-0.322 -0.643,-4.76 -4.695,-4.76c-4.181,0 -3.216,4.245 -4.695,4.76c-1.48,0.514 -2.38,1.672 -2.38,3.28c3.28,0.193 1.544,2.958 2.766,3.344c1.222,0.45 1.736,0.515 2.186,1.479c0.322,0.708 0.836,1.287 2.123,1.287c2.122,-0 1.865,-1.801 2.958,-2.123c2.83,-0.836 0.193,-3.473 4.052,-3.28c0.064,-1.608 0.064,-3.409 -2.315,-3.987Z" | ||
fillRule="nonzero" | ||
fill="#f45d00" | ||
stroke="#2a2a2a" | ||
strokeWidth="1.29px" | ||
/> | ||
<use | ||
xlinkHref="#_Image1" | ||
x="11.534" | ||
y="10.215" | ||
width="4.181px" | ||
height="2.315px" | ||
transform="matrix(0.83611,0,0,0.771794,0,0)" | ||
/> | ||
</g> | ||
</g> | ||
<defs> | ||
<image | ||
id="_Image1" | ||
width="5px" | ||
height="3px" | ||
xlinkHref="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAADCAYAAABbNsX4AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAOElEQVQImS3KUQ2AIAAFwGMzASVwLwrt6GAHRxOcGTSDP973lSQDDR0nVknyoGLHwrvh+OeNiesDHtoJuXOdP8QAAAAASUVORK5CYII=" | ||
/> | ||
</defs> | ||
</svg> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from './hacktoberfest-2022'; | ||
export * from './hacktoberfest-2023'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.