Skip to content

Commit

Permalink
fix(assets): import assets directly
Browse files Browse the repository at this point in the history
  • Loading branch information
KatvonRivia committed Aug 15, 2023
1 parent f35b61a commit 144117b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/scripts/components/main/menu/menu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, {FunctionComponent, useState} from 'react';
import {FormattedMessage} from 'react-intl';

import planeratyVisionsLogo from '~/assets/images/planetary-visions.png';

import LanguageSelector from '../language-selector/language-selector';
import Button from '../button/button';
import {PresenterIcon} from '../icons/presenter-icon';
Expand Down Expand Up @@ -199,7 +201,7 @@ const Menu: FunctionComponent<Props> = ({onRestartOnboarding}) => {
<p className={styles.creditsText}>
<FormattedMessage id={'contentBy'} />
</p>
<img src={config.planeratyVisionsLogo} />
<img src={planeratyVisionsLogo} />
</a>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/config/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export default {
twitter:
'http://twitter.com/intent/tweet?text=ESA%20Climate%20From%20Space&url={currentUrl}'
},
planeratyVisionsLogo: 'assets/images/planetary-visions.png',

esaLogo: 'assets/images/esa-logo.png',
ubilabsWebsite: 'https://ubilabs.com',
planetaryVisionsWebsite: 'http://planetaryvisions.com/',
Expand Down
9 changes: 4 additions & 5 deletions src/scripts/libs/download-screenshot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import config from '../config/main';
import esaLogoSrc from '~/assets/images/esa-logo.png';

import {LayerListItem} from '../types/layer-list';

// Downloads one or both Cesium canvases as an image file
Expand All @@ -10,9 +11,7 @@ export function downloadScreenshot(
) {
const canvases = Array.from(
// eslint-disable-next-line no-undef
document.querySelectorAll('.cesium-viewer canvas') as NodeListOf<
HTMLCanvasElement
>
document.querySelectorAll('.globe canvas') as NodeListOf<HTMLCanvasElement>
);

const fileName = createFileName(
Expand Down Expand Up @@ -50,7 +49,7 @@ export function downloadScreenshot(
};

esaLogo.setAttribute('crossOrigin', 'anonymous');
esaLogo.src = config.esaLogo;
esaLogo.src = esaLogoSrc;
}

function combineCanvases(canvases: HTMLCanvasElement[]) {
Expand Down
5 changes: 5 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ export default defineConfig(({command}) => {
return {
root: './src',
base: './',
resolve: {
alias: {
'~': __dirname
}
},
build: {
outDir: '../dist',
emptyOutDir: true,
Expand Down

0 comments on commit 144117b

Please sign in to comment.