This repository was archived by the owner on Feb 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Added World Map to Academic Excellence Page #513
Open
shreyaswikriti
wants to merge
16
commits into
ocaml:master
Choose a base branch
from
shreyaswikriti:acad
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c685101
solved issue #415
shreyaswikriti 3c05591
conflicted files resolved
shreyaswikriti 1d6fece
LogoCloud added in UserPage
shreyaswikriti 2fd7c39
small changes
shreyaswikriti 0b344be
ood industrial data added
shreyaswikriti 13ca874
removed example company data
shreyaswikriti e5b03a1
Merge branch 'master' into acad
shreyaswikriti 7497d32
Map for Academic_Excellence page Added using React-leaflet
shreyaswikriti a9ca3e1
suggested changes applied
shreyaswikriti c66faee
Merge branch 'master' into acad
shreyaswikriti 14f4ef2
Update academic.res
shreyaswikriti a5475f8
suggested changes applied
shreyaswikriti 752471f
Merge branch 'acad' of https://github.com/shreyaswikriti/v3.ocaml.org…
shreyaswikriti 1631c2c
changes made
shreyaswikriti 6666cca
merge main branch and fix conflict in academic.res
patricoferris ff8eaea
update ood to fix longitudes and adjust font
patricoferris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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,87 @@ | ||
let s = React.string | ||
module MapContainer = Mapbinding.MapContainer | ||
module TileLayer = Mapbinding.TileLayer | ||
module Popup = Mapbinding.Popup | ||
module Marker = Mapbinding.Marker | ||
|
||
module MarkArray = { | ||
type t = { | ||
positions: Mapbinding.LatLng.t, | ||
name: string, | ||
} | ||
} | ||
|
||
type props = { | ||
"marginBottom": option<Tailwind.Breakpoint.t<Tailwind.Margin.Bottom.t>>, | ||
"zoom": float, | ||
"minZoom": float, | ||
"center": Mapbinding.LatLng.t, | ||
"position": array<Ood.Academic_institution.t>, | ||
"scrollWheelZoom": bool, | ||
"attribution": string, | ||
"url": string, | ||
"maxBound": Mapbinding.LatLng.bound, | ||
} | ||
@react.component | ||
let make = (~props: props) => { | ||
let marginBottom = props["marginBottom"] | ||
let zoom = props["zoom"] | ||
let center = props["center"] | ||
let acads = props["position"] | ||
let minZoom = props["minZoom"] | ||
let attribution = props["attribution"] | ||
let url = props["url"] | ||
let maxBound = props["maxBound"] | ||
let scrollWheelZoom = props["scrollWheelZoom"] | ||
let options = { | ||
Mapbinding.iconUrl: "/static/marker-icon.png", | ||
iconSize: { | ||
x: 25.0, | ||
y: 46.0, | ||
}, | ||
iconAnchor: { | ||
x: 13.0, | ||
y: 46.0, | ||
}, | ||
} | ||
let icon = Mapbinding.icon(Mapbinding.leaflet, ~options) | ||
let p = acads->Belt.Array.map((c: Ood.Academic_institution.t) => { | ||
MarkArray.name: c.Ood.Academic_institution.name, | ||
MarkArray.positions: { | ||
Mapbinding.LatLng.lat: switch c.Ood.Academic_institution.location { | ||
| None => 0.0 | ||
| Some(location) => location.lat | ||
}, | ||
lng: switch c.Ood.Academic_institution.location { | ||
| None => 0.0 | ||
| Some(location) => location.long | ||
}, | ||
}, | ||
}) | ||
|
||
<> | ||
<SectionContainer.MediumCentered ?marginBottom paddingX="px-12"> | ||
<h2 className="mb-16 text-grey-900 text-3xl mb-5 lg:text-4xl font-bold text-center"> | ||
{s("OCaml Courses around the World")} | ||
</h2> | ||
</SectionContainer.MediumCentered> | ||
<SectionContainer.ResponsiveCentered ?marginBottom> | ||
// TODO: try switching to a grid | ||
<div className="bg-white flex-wrap justify-center lg:justify-between m-8 "> | ||
<MapContainer center zoom scrollWheelZoom maxBounds=maxBound minZoom className="h-160"> | ||
<TileLayer attribution url noWrap=true /> | ||
{p | ||
|> Array.map(c => | ||
<Marker key={c.name} position=c.MarkArray.positions icon> | ||
<Popup className="h-16 font-bold text-md text-center "> | ||
{React.string(c.name)} | ||
</Popup> | ||
</Marker> | ||
) | ||
|> React.array} | ||
</MapContainer> | ||
</div> | ||
</SectionContainer.ResponsiveCentered> | ||
</> | ||
} | ||
let default = make |
This file contains hidden or 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,21 @@ | ||
module MarkArray: { | ||
type t = { | ||
positions: Mapbinding.LatLng.t, | ||
name: string, | ||
} | ||
} | ||
type props = { | ||
"marginBottom": option<Tailwind.Breakpoint.t<Tailwind.Margin.Bottom.t>>, | ||
"zoom": float, | ||
"minZoom": float, | ||
"center": Mapbinding.LatLng.t, | ||
"position": array<Ood.Academic_institution.t>, | ||
"scrollWheelZoom": bool, | ||
"attribution": string, | ||
"url": string, | ||
"maxBound": Mapbinding.LatLng.bound, | ||
} | ||
|
||
@react.component | ||
let make: (~props: props) => React.element | ||
let default: {"props": props} => React.element |
This file contains hidden or 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,72 @@ | ||
module LatLng = { | ||
type t = { | ||
lat: float, | ||
lng: float, | ||
} | ||
type bound = { | ||
mib: t, | ||
mab: t, | ||
} | ||
} | ||
module Point = { | ||
type t = { | ||
x: float, | ||
y: float, | ||
} | ||
} | ||
module MapContainer = { | ||
@module("react-leaflet") @react.component | ||
external make: ( | ||
~className: string=?, | ||
~center: LatLng.t, | ||
~zoom: float, | ||
~zoomControl: bool=?, | ||
~scrollWheelZoom: bool, | ||
~id: string=?, | ||
~minZoom: float, | ||
~maxBounds: LatLng.bound, | ||
~children: React.element, | ||
) => React.element = "MapContainer" | ||
} | ||
module TileLayer = { | ||
@module("react-leaflet") @react.component | ||
external make: (~attribution: string=?, ~noWrap: bool, ~url: string) => React.element = | ||
"TileLayer" | ||
} | ||
//Abstract Icon type | ||
type icon | ||
|
||
type iconOptions = {iconUrl: string, iconSize: Point.t, iconAnchor: Point.t} | ||
|
||
// Abstract Leaflet Object type | ||
type leaflet | ||
|
||
// Binding to the Leaflet function `icon` which creates an Icon object | ||
@send external icon: (leaflet, ~options: iconOptions) => icon = "icon" | ||
@val external leaflet: leaflet = "L" | ||
|
||
module Marker = { | ||
@module("react-leaflet") @react.component | ||
external make: (~position: LatLng.t, ~icon: icon=?, ~children: React.element=?) => React.element = | ||
"Marker" | ||
} | ||
|
||
module Popup = { | ||
@module("react-leaflet") @react.component | ||
external make: ( | ||
~maxWidth: int=?, | ||
~minWidth: int=?, | ||
~maxHeight: int=?, | ||
~autoPan: bool=?, | ||
~autoPanPaddingTopLeft: Point.t=?, | ||
~autoPanPaddingBottomRight: Point.t=?, | ||
~autoPanPadding: Point.t=?, | ||
~keepInView: bool=?, | ||
~closeButton: bool=?, | ||
~autoClose: bool=?, | ||
~closeOnEscapeKey: bool=?, | ||
~closeOnClick: bool=?, | ||
~className: string=?, | ||
~children: React.element=?, | ||
) => React.element = "Popup" | ||
} |
This file contains hidden or 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,70 @@ | ||
module LatLng: { | ||
type t = { | ||
lat: float, | ||
lng: float, | ||
} | ||
type bound = { | ||
mib: t, | ||
mab: t, | ||
} | ||
} | ||
module Point: { | ||
type t = { | ||
x: float, | ||
y: float, | ||
} | ||
} | ||
module MapContainer: { | ||
@react.component | ||
let make: ( | ||
~className: string=?, | ||
~center: LatLng.t, | ||
~zoom: float, | ||
~zoomControl: bool=?, | ||
~scrollWheelZoom: bool, | ||
~id: string=?, | ||
~minZoom: float, | ||
~maxBounds: LatLng.bound, | ||
~children: React.element, | ||
) => React.element | ||
} | ||
module TileLayer: { | ||
@react.component | ||
let make: (~attribution: string=?, ~noWrap: bool, ~url: string) => React.element | ||
} | ||
//Abstract Icon type | ||
type icon | ||
|
||
type iconOptions = {iconUrl: string, iconSize: Point.t, iconAnchor: Point.t} | ||
|
||
// Abstract Leaflet Object type | ||
type leaflet | ||
|
||
// Binding to the Leaflet function `icon` which creates an Icon object | ||
@send external icon: (leaflet, ~options: iconOptions) => icon = "icon" | ||
@val external leaflet: leaflet = "L" | ||
|
||
module Marker: { | ||
@react.component | ||
let make: (~position: LatLng.t, ~icon: icon=?, ~children: React.element=?) => React.element | ||
} | ||
|
||
module Popup: { | ||
@react.component | ||
let make: ( | ||
~maxWidth: int=?, | ||
~minWidth: int=?, | ||
~maxHeight: int=?, | ||
~autoPan: bool=?, | ||
~autoPanPaddingTopLeft: Point.t=?, | ||
~autoPanPaddingBottomRight: Point.t=?, | ||
~autoPanPadding: Point.t=?, | ||
~keepInView: bool=?, | ||
~closeButton: bool=?, | ||
~autoClose: bool=?, | ||
~closeOnEscapeKey: bool=?, | ||
~closeOnClick: bool=?, | ||
~className: string=?, | ||
~children: React.element=?, | ||
) => React.element | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.