Skip to content

Commit

Permalink
#31, #55 - Add pixel-based country highlighting and variant image gen…
Browse files Browse the repository at this point in the history
…eration
  • Loading branch information
wellsfletcher committed Jun 12, 2024
1 parent 543197c commit 4cf0197
Show file tree
Hide file tree
Showing 2,058 changed files with 15,494 additions and 155 deletions.
Binary file added app/assets/highlights/Q1000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1013.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1014.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1016.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1019.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1025.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1028.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1029.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1030.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1032.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1033.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1036.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1037.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1041.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1044.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1045.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1049.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q1050.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/highlights/Q115.png
Binary file added app/assets/highlights/Q1166.png
Binary file added app/assets/highlights/Q117.png
Binary file added app/assets/highlights/Q1183.png
Binary file added app/assets/highlights/Q1204.png
Binary file added app/assets/highlights/Q1207.png
Binary file added app/assets/highlights/Q1211.png
Binary file added app/assets/highlights/Q1212.png
Binary file added app/assets/highlights/Q1214.png
Binary file added app/assets/highlights/Q1221.png
Binary file added app/assets/highlights/Q1223.png
Binary file added app/assets/highlights/Q1227.png
Binary file added app/assets/highlights/Q1246.png
Binary file added app/assets/highlights/Q1261.png
Binary file added app/assets/highlights/Q129003.png
Binary file added app/assets/highlights/Q1370.png
Binary file added app/assets/highlights/Q1371.png
Binary file added app/assets/highlights/Q1384.png
Binary file added app/assets/highlights/Q1387.png
Binary file added app/assets/highlights/Q1391.png
Binary file added app/assets/highlights/Q1393.png
Binary file added app/assets/highlights/Q1397.png
Binary file added app/assets/highlights/Q1400.png
Binary file added app/assets/highlights/Q1408.png
Binary file added app/assets/highlights/Q1415.png
Binary file added app/assets/highlights/Q142.png
Binary file added app/assets/highlights/Q1428.png
Binary file added app/assets/highlights/Q1439.png
Binary file added app/assets/highlights/Q145.png
Binary file added app/assets/highlights/Q1454.png
Binary file added app/assets/highlights/Q1456.png
Binary file added app/assets/highlights/Q148.png
Binary file added app/assets/highlights/Q1494.png
Binary file added app/assets/highlights/Q1509.png
Binary file added app/assets/highlights/Q1522.png
Binary file added app/assets/highlights/Q1527.png
Binary file added app/assets/highlights/Q1537.png
Binary file added app/assets/highlights/Q1546.png
Binary file added app/assets/highlights/Q155.png
Binary file added app/assets/highlights/Q1553.png
Binary file added app/assets/highlights/Q1558.png
Binary file added app/assets/highlights/Q1581.png
Binary file added app/assets/highlights/Q1588.png
Binary file added app/assets/highlights/Q159.png
Binary file added app/assets/highlights/Q16.png
Binary file added app/assets/highlights/Q1603.png
Binary file added app/assets/highlights/Q1612.png
Binary file added app/assets/highlights/Q1649.png
Binary file added app/assets/highlights/Q16551.png
Binary file added app/assets/highlights/Q17.png
Binary file added app/assets/highlights/Q173.png
Binary file added app/assets/highlights/Q183.png
Binary file added app/assets/highlights/Q184.png
Binary file added app/assets/highlights/Q189.png
Binary file added app/assets/highlights/Q191.png
Binary file added app/assets/highlights/Q20.png
Binary file added app/assets/highlights/Q211.png
Binary file added app/assets/highlights/Q212.png
Binary file added app/assets/highlights/Q213.png
Binary file added app/assets/highlights/Q214.png
Binary file added app/assets/highlights/Q215.png
Binary file added app/assets/highlights/Q217.png
Binary file added app/assets/highlights/Q218.png
Binary file added app/assets/highlights/Q219.png
Binary file added app/assets/highlights/Q221.png
Binary file added app/assets/highlights/Q222.png
Binary file added app/assets/highlights/Q223.png
Binary file added app/assets/highlights/Q224.png
Binary file added app/assets/highlights/Q225.png
Binary file added app/assets/highlights/Q227.png
Binary file added app/assets/highlights/Q229.png
Binary file added app/assets/highlights/Q230.png
Binary file added app/assets/highlights/Q232.png
Binary file added app/assets/highlights/Q236.png
Binary file added app/assets/highlights/Q23681.png
Binary file added app/assets/highlights/Q23792.png
Binary file added app/assets/highlights/Q241.png
Binary file added app/assets/highlights/Q242.png
Binary file added app/assets/highlights/Q252.png
Binary file added app/assets/highlights/Q258.png
Binary file added app/assets/highlights/Q262.png
Binary file added app/assets/highlights/Q265.png
Binary file added app/assets/highlights/Q27.png
Binary file added app/assets/highlights/Q28.png
Binary file added app/assets/highlights/Q29.png
Binary file added app/assets/highlights/Q298.png
Binary file added app/assets/highlights/Q31.png
Binary file added app/assets/highlights/Q32.png
Binary file added app/assets/highlights/Q33.png
Binary file added app/assets/highlights/Q33788.png
Binary file added app/assets/highlights/Q34.png
Binary file added app/assets/highlights/Q34754.png
Binary file added app/assets/highlights/Q35.png
Binary file added app/assets/highlights/Q36.png
Binary file added app/assets/highlights/Q37.png
Binary file added app/assets/highlights/Q38.png
Binary file added app/assets/highlights/Q39.png
Binary file added app/assets/highlights/Q399.png
Binary file added app/assets/highlights/Q40.png
Binary file added app/assets/highlights/Q403.png
Binary file added app/assets/highlights/Q408.png
Binary file added app/assets/highlights/Q41.png
Binary file added app/assets/highlights/Q414.png
Binary file added app/assets/highlights/Q419.png
Binary file added app/assets/highlights/Q423.png
Binary file added app/assets/highlights/Q424.png
Binary file added app/assets/highlights/Q43.png
Binary file added app/assets/highlights/Q45.png
Binary file added app/assets/highlights/Q51.png
Binary file added app/assets/highlights/Q55.png
Binary file added app/assets/highlights/Q574.png
Binary file added app/assets/highlights/Q61.png
Binary file added app/assets/highlights/Q6250.png
Binary file added app/assets/highlights/Q657.png
Binary file added app/assets/highlights/Q664.png
Binary file added app/assets/highlights/Q668.png
Binary file added app/assets/highlights/Q685.png
Binary file added app/assets/highlights/Q686.png
Binary file added app/assets/highlights/Q691.png
Binary file added app/assets/highlights/Q711.png
Binary file added app/assets/highlights/Q712.png
Binary file added app/assets/highlights/Q717.png
Binary file added app/assets/highlights/Q724.png
Binary file added app/assets/highlights/Q730.png
Binary file added app/assets/highlights/Q733.png
Binary file added app/assets/highlights/Q734.png
Binary file added app/assets/highlights/Q736.png
Binary file added app/assets/highlights/Q739.png
Binary file added app/assets/highlights/Q750.png
Binary file added app/assets/highlights/Q754.png
Binary file added app/assets/highlights/Q759.png
Binary file added app/assets/highlights/Q766.png
Binary file added app/assets/highlights/Q77.png
Binary file added app/assets/highlights/Q771.png
Binary file added app/assets/highlights/Q774.png
Binary file added app/assets/highlights/Q778.png
Binary file added app/assets/highlights/Q779.png
Binary file added app/assets/highlights/Q782.png
Binary file added app/assets/highlights/Q783.png
Binary file added app/assets/highlights/Q786.png
Binary file added app/assets/highlights/Q79.png
Binary file added app/assets/highlights/Q790.png
Binary file added app/assets/highlights/Q792.png
Binary file added app/assets/highlights/Q794.png
Binary file added app/assets/highlights/Q796.png
Binary file added app/assets/highlights/Q797.png
Binary file added app/assets/highlights/Q800.png
Binary file added app/assets/highlights/Q801.png
Binary file added app/assets/highlights/Q804.png
Binary file added app/assets/highlights/Q805.png
Binary file added app/assets/highlights/Q810.png
Binary file added app/assets/highlights/Q811.png
Binary file added app/assets/highlights/Q812.png
Binary file added app/assets/highlights/Q813.png
Binary file added app/assets/highlights/Q816.png
Binary file added app/assets/highlights/Q817.png
Binary file added app/assets/highlights/Q819.png
Binary file added app/assets/highlights/Q822.png
Binary file added app/assets/highlights/Q824.png
Binary file added app/assets/highlights/Q829.png
Binary file added app/assets/highlights/Q833.png
Binary file added app/assets/highlights/Q836.png
Binary file added app/assets/highlights/Q837.png
Binary file added app/assets/highlights/Q842.png
Binary file added app/assets/highlights/Q843.png
Binary file added app/assets/highlights/Q846.png
Binary file added app/assets/highlights/Q851.png
Binary file added app/assets/highlights/Q854.png
Binary file added app/assets/highlights/Q858.png
Binary file added app/assets/highlights/Q863.png
Binary file added app/assets/highlights/Q865.png
Binary file added app/assets/highlights/Q869.png
Binary file added app/assets/highlights/Q874.png
Binary file added app/assets/highlights/Q878.png
Binary file added app/assets/highlights/Q881.png
Binary file added app/assets/highlights/Q884.png
Binary file added app/assets/highlights/Q889.png
Binary file added app/assets/highlights/Q902.png
Binary file added app/assets/highlights/Q912.png
Binary file added app/assets/highlights/Q916.png
Binary file added app/assets/highlights/Q917.png
Binary file added app/assets/highlights/Q921.png
Binary file added app/assets/highlights/Q924.png
Binary file added app/assets/highlights/Q928.png
Binary file added app/assets/highlights/Q929.png
Binary file added app/assets/highlights/Q945.png
Binary file added app/assets/highlights/Q948.png
Binary file added app/assets/highlights/Q953.png
Binary file added app/assets/highlights/Q954.png
Binary file added app/assets/highlights/Q958.png
Binary file added app/assets/highlights/Q96.png
Binary file added app/assets/highlights/Q962.png
Binary file added app/assets/highlights/Q963.png
Binary file added app/assets/highlights/Q9648.png
Binary file added app/assets/highlights/Q965.png
Binary file added app/assets/highlights/Q967.png
Binary file added app/assets/highlights/Q971.png
Binary file added app/assets/highlights/Q974.png
Binary file added app/assets/highlights/Q977.png
Binary file added app/assets/highlights/Q983.png
Binary file added app/assets/highlights/Q986.png
Binary file added app/assets/highlights/Q99.png
Binary file added app/assets/highlights/empty.png
15 changes: 12 additions & 3 deletions app/components/Board.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { drawPixel, drawPixelBuffer, drawPixelRgbaBuffer, drawImageData, paintCa
import {CanvasGlobeProps} from "./Globe";
import useFancyCanvas from "./hooks/useFancyCanvas";
import {Baseboard} from "../constants/Baseboard";
import useImage from "./hooks/useImage";
// import Tooltip from './TrackingTooltip.js';


Expand Down Expand Up @@ -181,6 +182,9 @@ const Board = (props: CanvasGlobeProps) => {
const [flashBackImage, setFlashbackImage] = usePreloadedImage(System.FLASHBACK_BOARD_PATH);
const [coloringBaseboardImage, setColoringBaseboardImage] = usePreloadedImage(System.COLORING_BASEBOARD_PATH);

const highlightFileName = (props.activeCountry == null || props.activeCountry == "" ? "empty" : props.activeCountry) + ".png";
const territoryHighlightImage = useImage(System.HIGHLIGHTS_FOLDER + highlightFileName);

const drawBoard = (ctx: CanvasRenderingContext2D, frameCount: number) => {
drawPixelRgbaBuffer(ctx, tilesRgba, width);
}
Expand All @@ -190,14 +194,19 @@ const Board = (props: CanvasGlobeProps) => {
const drawColoringBaseboard = (ctx: CanvasRenderingContext2D, frameCount: number) => {
fillCanvasWithImage(ctx, coloringBaseboardImage, width, height);
}
const drawHighlight = (ctx: CanvasRenderingContext2D, frameCount: number) => {
if (territoryHighlightImage != null) {
fillCanvasWithImage(ctx, territoryHighlightImage, width, height);
}
}

let layers = [];
if (activeBaseboard == Baseboard.FLASHBACK) {
layers = [drawFlashback];
layers = [drawFlashback, drawHighlight];
} else if (activeBaseboard == Baseboard.COLORING) {
layers = [drawColoringBaseboard];
layers = [drawColoringBaseboard, drawHighlight];
} else {
layers = [drawBoard];
layers = [drawBoard, drawHighlight];
}

const canvasRef = useFancyCanvas(layers);
Expand Down
23 changes: 16 additions & 7 deletions app/components/CountryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,22 @@ export default function MediaCard(props) {
</CardActionArea>
<CardActions>
<Button size="small" color="primary" onClick={() => {
var nextCountry = props.label;
/*
if (props.activeCountry === props.label) {
nextCountry = "noCountrySelected";
}
*/
props.setActiveCountry(nextCountry)
// console.log("props = ");
// console.log(props);
// alert('clicked');
// var nextCountry = props.label;
let nextCountry = props.country.wikidataid;
/*
if (props.activeCountry === props.label) {
nextCountry = "noCountrySelected";
}
*/
// to avoid using unnecessary rerenders, imma gonna try to move this logic to setActiveCountry maybe?
// console.log(["nextCountry", nextCountry, "props.activeCountry", props.activeCountry]);
// if (nextCountry == props.activeCountry) {
// nextCountry = ""; // or null
// }
props.setActiveCountry(nextCountry);
}}>
Show
</Button>
Expand Down
34 changes: 30 additions & 4 deletions app/components/Globe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {drawPixelRgbaBuffer, fillCanvasWithImage} from '../utils/draw';
import useFancyCanvas from "./hooks/useFancyCanvas";
import {Baseboard} from "../constants/Baseboard";
import {COLORING_BASEBOARD_PATH} from "../constants/system";
import useImage from "./hooks/useImage";

// THREE.WebGLRenderer._useLegacyLights = true;
// THREE.WebGLRendererParameters;
Expand Down Expand Up @@ -134,6 +135,18 @@ function CanvasGlobe(props: CanvasGlobeProps) {
const [flashBackImage, setFlashbackImage] = usePreloadedImage(System.FLASHBACK_BOARD_PATH);
const [coloringBaseboardImage, setColoringBaseboardImage] = usePreloadedImage(System.COLORING_BASEBOARD_PATH);

const highlightFileName = (props.activeCountry == null || props.activeCountry == "" ? "empty" : props.activeCountry) + ".png";
// const highlightFileName = (props.activeCountry == null || props.activeCountry == "" ? "Q16" : props.activeCountry) + ".png";
// console.log(["highlightFileName", highlightFileName]);
// const [territoryHighlightImage, setTerritoryHighlightImage] = usePreloadedImage(System.CANADA_HIGHLIGHT_PATH);
// wait is the functions input just the initial value? I think it's probably like just not done loading, when click it
// TODO: figure out the above problem
//- const [territoryHighlightImage, setTerritoryHighlightImage] = usePreloadedImage(System.HIGHLIGHTS_FOLDER + highlightFileName);
// const [territoryHighlightImage, setTerritoryHighlightImage] = usePreloadedImage(System.HIGHLIGHTS_FOLDER + "Q16.png");
const territoryHighlightImage = useImage(System.HIGHLIGHTS_FOLDER + highlightFileName);

// console.log(["System.CANADA_HIGHLIGHT_PATH", System.CANADA_HIGHLIGHT_PATH]);

const drawBoard = (ctx: CanvasRenderingContext2D, frameCount: number) => {
drawPixelRgbaBuffer(ctx, tilesRgba, width);
}
Expand All @@ -143,14 +156,19 @@ function CanvasGlobe(props: CanvasGlobeProps) {
const drawColoringBaseboard = (ctx: CanvasRenderingContext2D, frameCount: number) => {
fillCanvasWithImage(ctx, coloringBaseboardImage, width, height);
}
const drawHighlight = (ctx: CanvasRenderingContext2D, frameCount: number) => {
if (territoryHighlightImage != null) {
fillCanvasWithImage(ctx, territoryHighlightImage, width, height);
}
}

let layers = [];
if (activeBaseboard == Baseboard.FLASHBACK) {
layers = [drawFlashback];
layers = [drawFlashback, drawHighlight];
} else if (activeBaseboard == Baseboard.COLORING) {
layers = [drawColoringBaseboard];
layers = [drawColoringBaseboard, drawHighlight];
} else {
layers = [drawBoard];
layers = [drawBoard, drawHighlight];
}

// const options = {
Expand Down Expand Up @@ -339,7 +357,7 @@ function CanvasGlobe(props: CanvasGlobeProps) {

const directionalLight = globeEl.current.lights().find(obj3d => obj3d.type === 'DirectionalLight');
directionalLight.intensity = 0.03 * Math.PI;
}, [props.viewFlashback, props.tiles, props.activeBaseboard]);
}, [territoryHighlightImage, props.viewFlashback, props.tiles, props.activeBaseboard]);
// React.useEffect(() => {
// texture.needsUpdate = true;
// }, [props.viewFlashback, props.tiles]);
Expand Down Expand Up @@ -498,6 +516,8 @@ function CanvasGlobe(props: CanvasGlobeProps) {
fetch('/assets/ne_110m_admin_0_countries.geojson').then(res => res.json()).then(setCountries);
}, []);
*/

// this right here really needs to be renamed
const [activeCountry, setActiveCountry] = React.useState([]);

React.useEffect(() => {
Expand All @@ -509,6 +529,12 @@ function CanvasGlobe(props: CanvasGlobeProps) {
if (props.activeCountry == null || props.activeCountry == "") {
return;
}
// console.debug("props.activeCountry = ");
// console.debug(props.activeCountry);

// --- probably don't need to fetch the geojson anymore hopefully --- //
return;

API.fetchTerritoryGeojsonFromName(props.activeCountry).then(res => {
console.log("fetched country = ");
console.log(res);
Expand Down
29 changes: 29 additions & 0 deletions app/components/hooks/useImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { useState, useEffect } from 'react';

function useImage(imagePath: string): HTMLImageElement | null {
const [image, setImage] = useState<HTMLImageElement | null>(null);

useEffect(() => {
if (!imagePath) {
setImage(null);
return;
}

const img = new Image();
img.src = imagePath;

const handleLoad = () => {
setImage(img);
};

img.onload = handleLoad;

return () => {
img.onload = null; // Cleanup to avoid memory leaks
};
}, [imagePath]);

return image;
}

export default useImage;
4 changes: 2 additions & 2 deletions app/components/hooks/usePreloadedImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import React, { useState, useEffect, useRef } from 'react';
export default function usePreloadedImage(path: string): [HTMLImageElement, any] {
const [image, setImage] = useState<HTMLImageElement>(new Image());
useEffect(() => {
// console.log("image loading");
// image.src = "../../assets/pixel-countries-mid-res.png";
image.src = path;
image.onload = () => {
//- console.log("image " + path + " loaded"); // uncomment this to view base 64 encoding
// console.log(image);
};
setImage(image);
}, []); // TODO: should probably update this to change when the "path" parameter changes
}, []); // TODO: should probably update this to change when the "path" parameter changes // nah nvm I shouldn't
// }, [path]);
return [image, setImage];
}
10 changes: 10 additions & 0 deletions app/constants/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,13 @@ import FLASHBACK_BOARD from '../assets/pixel-countries-mid-res.png';
export const FLASHBACK_BOARD_PATH = FLASHBACK_BOARD;
import COLORING_BASEBOARD from '../assets/COLORING.png';
export const COLORING_BASEBOARD_PATH = COLORING_BASEBOARD;

// import HIGHLIGHTS_FOLDER from '../assets/highlights/';
// export const CANADA_HIGHLIGHT = HIGHLIGHTS_FOLDER + CANADA_HIGHLIGHT;

// import CANADA_HIGHLIGHT from '../assets/highlights/Q16.png';
// export const CANADA_HIGHLIGHT_PATH = CANADA_HIGHLIGHT;

// TODO: this probably won't work during npm run build, so fix it
export const CANADA_HIGHLIGHT_PATH = '../assets/highlights/Q16.png';
export const HIGHLIGHTS_FOLDER = '../assets/highlights/';
8 changes: 7 additions & 1 deletion app/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,13 @@ const rootSlice = createSlice({
return { ...state, mouseDown: action.payload };
},
setActiveCountry(state: BaseState, action) {
return { ...state, board: {...state.board, activeCountry: action.payload} };
// extra logic to allow toggle behavior
// TODO: maybe just move this to the CountryCard actually so like the CountryCard also shows if that country is active or not
let nextCountry = action.payload;
if (state.board.activeCountry == action.payload) {
nextCountry = "";
}
return { ...state, board: {...state.board, activeCountry: nextCountry} };
},
setBrushColor(state: BaseState, action) {
return { ...state, brushColor: action.payload };
Expand Down
Loading

0 comments on commit 4cf0197

Please sign in to comment.