Skip to content

Commit

Permalink
[Fixes GeoNode#955] Blured icon images (GeoNode#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidQuartz authored Jul 7, 2022
1 parent 8b9b36c commit a0d313f
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 37 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ import React from 'react';
import FaIcon from '@js/components/FaIcon';
import Message from '@mapstore/framework/components/I18N/Message';

function MainErrorView({
msgId
function MainEventView({
msgId,
icon
}) {
return (
<div className="gn-main-event-container">
<div className="gn-main-event-content">
<div className="gn-main-event-text">
<div className="gn-main-icon">
<FaIcon name="exclamation"/>
<FaIcon name={icon} />
</div>
{msgId && <Message msgId={msgId} />}
</div>
Expand All @@ -27,8 +28,9 @@ function MainErrorView({
);
}

MainErrorView.defaultProps = {
msgId: ''
MainEventView.defaultProps = {
msgId: '',
icon: 'exclamation'
};

export default MainErrorView;
export default MainEventView;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './MainEventView';
22 changes: 5 additions & 17 deletions geonode_mapstore_client/client/js/components/MediaViewer/Media.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,14 @@ import MediaComponent from '@mapstore/framework/components/geostory/media';
import PdfViewer from '@js/components/MediaViewer/PdfViewer';
import { determineResourceType } from '@js/utils/FileUtils';
import Loader from '@mapstore/framework/components/misc/Loader';
import MainErrorView from '@js/components/MainErrorView';
import MainEventView from '@js/components/MainEventView';
import { getResourceTypesInfo } from '@js/utils/ResourceUtils';

const Scene3DViewer = lazy(() => import('@js/components/MediaViewer/Scene3DViewer'));

function UnsupportedViewer({ thumbnail }) {
function UnsupportedViewer() {
return (
<div
className="gn-media-unsupported"
style={{
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%',
backgroundImage: `url(${thumbnail})`,
backgroundSize: 'contain',
backgroundPosition: 'center'
}}>
</div>
<MainEventView msgId={'gnhome.noPreview'} icon="file" />
);
}

Expand Down Expand Up @@ -60,7 +48,7 @@ const mediaDefaultProps = {
unsupported: {}
};

const Media = ({resource, ...props}) => {
const Media = ({ resource, ...props }) => {

const mediaTypes = getResourceTypesInfo();
const {
Expand All @@ -83,7 +71,7 @@ const Media = ({resource, ...props}) => {
/>
</Suspense>);
}
return (<MainErrorView msgId={'gnhome.permissionsMissing'}/>);
return (<MainEventView msgId={'gnhome.permissionsMissing'}/>);
};

export default Media;
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ describe('Test Media', () => {
ReactDOM.render( <Media resource={{href: "http://example.com", thumbnail_url: 'image', resource_type: "document", extension: "docx", "abstract": "test", pk: 1, perms: [
"download_resourcebase"
] }}/>, document.getElementById("container"));
const mediaViewer = document.querySelector('.gn-media-unsupported');
const mediaViewer = document.querySelector('.gn-main-event-container');
expect(mediaViewer).toBeTruthy();
expect(mediaViewer.style.backgroundImage).toBe('url("image")');
});

it('should render error message if resource has not download perms', () => {
Expand Down
4 changes: 2 additions & 2 deletions geonode_mapstore_client/client/js/routes/Viewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import PluginsContainer from '@mapstore/framework/components/plugins/PluginsCont
import useLazyPlugins from '@js/hooks/useLazyPlugins';
import { requestResourceConfig, requestNewResourceConfig } from '@js/actions/gnresource';
import MetaTags from '@js/components/MetaTags';
import MainErrorView from '@js/components/MainErrorView';
import MainEventView from '@js/components/MainEventView';
import ViewerLayout from '@js/components/ViewerLayout';
import { createShallowSelector } from '@mapstore/framework/utils/ReselectUtils';

Expand Down Expand Up @@ -139,7 +139,7 @@ function ViewerRoute({
params={params}
/>}
{loading && Loader && <Loader />}
{configError && <MainErrorView msgId={configError}/>}
{configError && <MainEventView msgId={configError}/>}
</>
);
}
Expand Down
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"author": "GeoSolutions",
"license": "BSD-2-Clause",
"devDependencies": {
"@mapstore/project": "1.0.23",
"@mapstore/project": "1.0.24",
"dotenv": "10.0.0",
"jsdoc-to-markdown": "7.1.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
"createDataset": "Datensatz erstellen",
"search": "Suchen...",
"permissionsMissing": "Sie sind nicht berechtigt, diese Ressource anzuzeigen",
"filter": "Filter"
"filter": "Filter",
"noPreview": "Für diese Ressource ist keine Vorschau verfügbar"
},
"viewer": {
"document": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
"createDataset": "Create dataset",
"search": "Search...",
"permissionsMissing": "You don't have permission to view or download the resource",
"filter": "Filter"
"filter": "Filter",
"noPreview": "A preview is not available for this resource"
},
"viewer": {
"document": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
"createDataset": "Crear conjunto de datos",
"search": "Buscar...",
"permissionsMissing": "No tienes permiso para ver o descargar el recurso.",
"filter": "Filtrar"
"filter": "Filtrar",
"noPreview": "Una vista previa no está disponible para este recurso"
},
"viewer": {
"document": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@
"createDataset": "Créer un ensemble de données",
"search": "Chercher...",
"permissionsMissing": "Vous n'êtes pas autorisé à afficher ou télécharger la ressource",
"filter": "Filtre"
"filter": "Filtre",
"noPreview": "Un aperçu n'est pas disponible pour cette ressource"
},
"viewer": {
"document": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@
"createDataset": "Crea dataset",
"search": "Cerca...",
"permissionsMissing": "Non hai i permessi per visualizzare o scaricare la risorsa",
"filter": "Filtra"
"filter": "Filtra",
"noPreview": "Un'anteprima non è disponibile per questa risorsa"
},
"viewer": {
"document": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,26 @@
position: absolute;
margin: 1rem;

.ms-media,
.ms-media img {
.ms-media {
position: relative;
width: 100%;
height: 100%;
width: 100%
}

.ms-media-image {
display: flex;
align-items: center;
justify-content: center;
}

.ms-media img {
position: relative;
max-width: 100%;
max-height: 100%;
object-fit: contain;
cursor: pointer;
width: auto;
height: auto;
}

.pdf-loader {
Expand Down

0 comments on commit a0d313f

Please sign in to comment.