Skip to content

Commit

Permalink
Merge pull request #1359 from amir-azma/1334-fix-styles
Browse files Browse the repository at this point in the history
feat(details-tab): Fix style issue and re-factor details tab (#1359)
  • Loading branch information
jolevesq authored Oct 5, 2023
2 parents a80ae30 + 2e9e302 commit d729462
Show file tree
Hide file tree
Showing 9 changed files with 265 additions and 258 deletions.
2 changes: 0 additions & 2 deletions packages/geoview-core/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@
"zoom_to": "Zoom to feature",
"select": "Highlight feature on map",
"external_link": "External Link",
"mainDescription": "In order to start, select any visible layer on the map, if you do not see any layers on the map, please ensure to select them in the legend section",
"detailsView": "Details View",
"selectVisbleLayer": "Select any visible layer on the map to get started",
"availableLayers": "Available Layers",
"selectedFeature": "Selected Feature",
"feature": "feature",
"clickOnMap": "Click on map",
"nextFeatureBtn": "Next feature",
Expand Down
2 changes: 0 additions & 2 deletions packages/geoview-core/public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,9 @@
"zoom_to": "Zoom à l'élément",
"select": "Sélectionner l'élément sur la carte",
"external_link": "Lien externe",
"mainDescription": "Pour commencer, sélectionnez n'importe quelle couche visible sur la carte. Si vous ne voyez aucune couche sur la carte, assurez-vous de les sélectionner dans la section Légende.",
"detailsView": "Vue détaillée",
"selectVisbleLayer": "Sélectionnez n'importe quelle couche visible sur la carte pour commencer",
"availableLayers": "Couche disponibles",
"selectedFeature": "Fonctionnalité Item",
"feature": "item",
"clickOnMap": "Cliquer sur la carte",
"nextFeatureBtn": "Item suivant",
Expand Down
178 changes: 60 additions & 118 deletions packages/geoview-core/public/templates/raw-feature-info-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,46 @@ <h4 id="HUC1">1. Basic Map</h4><a class="ref-link" href="#top">Top</a>
'layerId': '0'
}
]
},
{
'geoviewLayerId': 'geojsonLYR1',
'geoviewLayerName': { 'en': 'GeoJSON Sample' },
'metadataAccessPath': { 'en': './geojson/metadata.json' },
'geoviewLayerType': 'GeoJSON',
'listOfLayerEntryConfig': [
{
'layerId': 'polygons.json',
'layerName': { 'en': 'Polygons' },
'layerFilter': 'creationDate >= date \'2020/02/15\''
},
{
'layerId': 'lines.json',
'layerName': { 'en': 'Lines' },
'layerFilter': 'creationDate >= date \'2020-05-28T12:00:00-05:00\''
},
{
'entryType': 'group',
'layerId': 'point-feature-group',
'layerName': { 'en': 'point-feature-group' },
'listOfLayerEntryConfig': [
{
'layerId': 'icon_points.json',
'layerName': { 'en': 'Icons' },
'initialSettings': { 'visible': 'yes' },
'layerFilter': 'creationDate >= date \'2020-01-14T12:00:01-05:00\''
},
{
'layerId': 'points.json',
'layerName': { 'en': 'Points' },
'layerFilter': 'creationDate >= date \'2019-02-15T22:00:00Z\''
}
]
}
]
}
]
},
'theme': 'light',
'theme': 'royal',
'navBar': ['zoom', 'fullscreen', 'home', 'location', 'export'],
'components': ['north-arrow', 'overview-map'],
'corePackages': ['footer-panel'],
Expand All @@ -116,102 +152,7 @@ <h4 id="HUC1">1. Basic Map</h4><a class="ref-link" href="#top">Top</a>
}"></div>
<hr />

<div
id="LYR1"
class="llwp-map"
triggerReadyCallback="true"
data-lang="en"
data-config="{
'map': {
'interaction': 'dynamic',
'viewSettings': {
'zoom': 4,
'center': [-100, 60],
'projection': 3978
},
'basemapOptions': {
'basemapId': 'transport',
'shaded': true,
'labeled': false
},
'listOfGeoviewLayerConfig': [
{
'geoviewLayerId': 'geojsonLYR1',
'geoviewLayerName': { 'en': 'GeoJSON Sample' },
'metadataAccessPath': { 'en': './geojson/metadata.json' },
'geoviewLayerType': 'GeoJSON',
'listOfLayerEntryConfig': [
{
'layerId': 'polygons.json',
'layerName': { 'en': 'Polygons' },
'layerFilter': 'creationDate >= date \'2020/02/15\''
},
{
'layerId': 'lines.json',
'layerName': { 'en': 'Lines' },
'layerFilter': 'creationDate >= date \'2020-05-28T12:00:00-05:00\''
},
{
'entryType': 'group',
'layerId': 'point-feature-group',
'layerName': { 'en': 'point-feature-group' },
'listOfLayerEntryConfig': [
{
'layerId': 'icon_points.json',
'layerName': { 'en': 'Icons' },
'initialSettings': { 'visible': 'yes' },
'layerFilter': 'creationDate >= date \'2020-01-14T12:00:01-05:00\''
},
{
'layerId': 'points.json',
'layerName': { 'en': 'Points' },
'layerFilter': 'creationDate >= date \'2019-02-15T22:00:00Z\''
}
]
}
]
},
{
'geoviewLayerId': 'esriFeatureLYR5',
'geoviewLayerName': {
'en': 'Top Projects'
},
'metadataAccessPath': {
'en': 'https://maps-cartes.services.geo.ca/server_serveur/rest/services/NRCan/900A_and_top_100_en/MapServer/'
},
'geoviewLayerType': 'esriFeature',
'listOfLayerEntryConfig': [
{
'layerId': '0'
}
]
},
{
'geoviewLayerId': 'esriFeatureLYR4',
'geoviewLayerName': {
'en': 'Water quality at monitoring sites'
},
'metadataAccessPath': {
'en': 'https://maps-cartes.ec.gc.ca/arcgis/rest/services/DMS/DEU_CSO_Volume/MapServer'
},
'geoviewLayerType': 'esriFeature',
'listOfLayerEntryConfig': [
{
'layerId': '8'
}
]
}
]
},
'components': ['overview-map'],
'overviewMap': {'hideOnZoom': 7},
'corePackages': ['footer-panel'],
'theme': 'light',
'suportedLanguages': ['en']
}"
></div>

<div
<!-- <div
id="LYR2"
class="llwp-map"
triggerReadyCallback="true"
Expand Down Expand Up @@ -304,7 +245,7 @@ <h4 id="HUC1">1. Basic Map</h4><a class="ref-link" href="#top">Top</a>
'theme': 'royal',
'suportedLanguages': ['en']
}"
></div>
></div> -->

<div id="resultMap" style="margin-top: 20px; margin-left: 15px;">Click on a layer on the map</div>

Expand All @@ -319,31 +260,32 @@ <h4 id="HUC1">1. Basic Map</h4><a class="ref-link" href="#top">Top</a>
console.log('api is ready');

// import react and api from the core
const { createRoot, api } = cgpv;

// const { createRoot, api } = cgpv;

cgpv.api.event.on(
cgpv.api.eventNames.GET_FEATURE_INFO.ALL_QUERIES_DONE,
(payload) => {
const { resultSets } = payload;
const newDetails = [];
// cgpv.api.event.on(
// cgpv.api.eventNames.GET_FEATURE_INFO.ALL_QUERIES_DONE,
// (payload) => {
// const { resultSets } = payload;
// const newDetails = [];

Object.keys(resultSets).forEach((layerPath) => {
const layerName = cgpv.api.utilities.getLocalizedValue(api.maps['LYR2'].layer.registeredLayers[layerPath].layerName, 'LYR2');
const features = resultSets[layerPath]?.data;
if (features?.length && features?.length > 0) {
newDetails.push({ layerPath, layerName, features });
}
});
// Object.keys(resultSets).forEach((layerPath) => {
// const layerName = cgpv.api.utilities.getLocalizedValue(api.maps['LYR2'].layer.registeredLayers[layerPath].layerName, 'LYR2');
// const features = resultSets[layerPath]?.data;
// if (features?.length && features?.length > 0) {
// newDetails.push({ layerPath, layerName, features });
// }
// });

// detailsResult has React Element type
const detailsResult = api.maps['LYR2'].detailsFooter.createDetailsFooter('LYR2', newDetails);
// // detailsResult has React Element type
// const detailsResult = api.maps['LYR2'].detailsFooter.createDetailsFooter('LYR2', newDetails);

const root = createRoot(document.getElementById("resultMap"));
root.render(detailsResult);
// const root = createRoot(document.getElementById("resultMap"));
// root.render(detailsResult);

},
'LYR2/$FeatureInfoLayerSet$'
);
// },
// 'LYR2/$FeatureInfoLayerSet$'
// );

//create snippets
createConfigSnippet();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import { Theme } from '@mui/material/styles';

export const getSxClasses = (theme: Theme) => ({
detailsContainer: {
background: theme.footerPanel.contentBg,
boxShadow: theme.footerPanel.contentShadow,
padding: '20px',
display: 'flex',
flexDirection: 'column',
},
footerTopPanleSecondary: {
font: theme.footerPanel.chooseLayerFont,
},
panelHeaders: {
font: theme.footerPanel.titleFont,
marginBottom: '20px',
},
layerListPaper: {
marginBottom: '1rem',
cursor: 'pointer',
textOverflow: 'ellipsis',
},
listItemIcon: {
color: theme.palette.primary.main,
background: theme.footerPanel.contentBg,
},
layerNamePrimary: {
font: theme.footerPanel.titleFont,
marginLeft: '10px',
},
list: {
color: 'text.primary',
marginLeft: '1rem',
width: '100%',
paddingRight: '2rem',
},
rightPanleContainer: {
border: `2px solid ${theme.palette.primary.main}`,
borderRadius: '5px',
marginRight: '20px',
backgroundColor: theme.palette.common.white,
},
rightPanelBtnHolder: {
marginTop: '20px',
marginBottom: '9px',
boxShadow: '0px 12px 9px -13px #E0E0E0',
},
itemText: {
fontSize: 14,
noWrap: true,
'& .MuiListItemText-primary': {
font: theme.footerPanel.titleFont,
},
'& .MuiListItemText-secondary': {
font: theme.footerPanel.layerSecondaryTitleFont,
color: theme.palette.common.black,
},
},
featureInfoListContainer: {
paddingLeft: '25px',
paddingRight: '25px',
paddingBottom: '25px',
height: '410px',
overflow: 'scroll',
},
featureInfoSingleImage: {
width: '35px',
height: '35px',
marginRight: '10px',
},
selectFeatureCheckbox: {
color: theme.palette.primary.main,
'&.Mui-checked': {
color: theme.palette.primary.main,
},
},
featureInfoItemValue: {
fontSize: '16px',
marginRight: 0,
marginTop: '5px',
wordBreak: 'break-word',
overflow: 'hidden',
textOverflow: 'ellipsis',
},
});
Loading

0 comments on commit d729462

Please sign in to comment.