-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(pages/element): use image to display location of discovery instead of using text only * perf(images): use `priority` to load image first * refactor(pages/element): rearrange the order of discovery and isolation * test(snapshot): updated all element page snapshot with new discovery location UI * fix(pages/element): no renderring on empty value * test(snapshot): updated all element page snapshot with conditional renderring on empty value (cpk color) * update(desktop): updated version from `0.0.5` to `0.1.0`
- Loading branch information
1 parent
0aea1d5
commit e81f050
Showing
313 changed files
with
144 additions
and
85 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,33 @@ | ||
import fs from 'fs'; | ||
|
||
import axios from 'axios'; | ||
|
||
import data from '@periotable/data'; | ||
|
||
import constants from '../../src/web/constant'; | ||
|
||
const element = () => { | ||
const path = `${process.cwd()}/public${constants.images.generated.country}`; | ||
|
||
if (!fs.existsSync(path)) { | ||
fs.mkdirSync(path, { | ||
recursive: true, | ||
}); | ||
} | ||
|
||
data.flatMap((data) => { | ||
return data.countries; | ||
}).forEach(async (country) => { | ||
const response = await axios.get(country.link, { | ||
responseType: 'arraybuffer', | ||
}); | ||
|
||
fs.writeFile(`${path}/${country.svg}`, response.data, (error) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
export default element; |
This file contains 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 @@ | ||
import fs from 'fs'; | ||
|
||
import axios from 'axios'; | ||
|
||
import { isNotUndefined } from '@poolofdeath20/util'; | ||
|
||
import data from '@periotable/data'; | ||
|
||
import constants from '../../src/web/constant'; | ||
import { obtainNameFromUrl } from '../../src/web/util/asset'; | ||
|
||
const element = () => { | ||
const paths = [ | ||
`public${constants.images.generated.bohr.interactive}`, | ||
`public${constants.images.generated.bohr.static}`, | ||
`public${constants.images.generated.spectrum}`, | ||
].map((path) => { | ||
return `${process.cwd()}/${path}`; | ||
}); | ||
|
||
paths.forEach((path) => { | ||
if (!fs.existsSync(path)) { | ||
fs.mkdirSync(path, { | ||
recursive: true, | ||
}); | ||
} | ||
}); | ||
|
||
data.flatMap((element) => { | ||
const { | ||
spectrum, | ||
bohrModel: { interactive, static: nonInteractive }, | ||
} = element; | ||
|
||
const newSpectrum = spectrum?.replace('360', '240'); | ||
|
||
return [ | ||
!interactive | ||
? undefined | ||
: { | ||
name: `${paths[0]}/${obtainNameFromUrl(interactive)}`, | ||
url: interactive, | ||
}, | ||
!nonInteractive | ||
? undefined | ||
: { | ||
name: `${paths[1]}/${obtainNameFromUrl(nonInteractive)}`, | ||
url: nonInteractive, | ||
}, | ||
!newSpectrum | ||
? undefined | ||
: { | ||
name: `${paths[2]}/${obtainNameFromUrl(newSpectrum)}`, | ||
url: newSpectrum, | ||
}, | ||
].filter(isNotUndefined); | ||
}).forEach(async (props) => { | ||
const response = await axios.get(props.url, { | ||
responseType: 'arraybuffer', | ||
}); | ||
|
||
fs.writeFile(props.name, response.data, (error) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
}); | ||
}; | ||
|
||
export default element; |
This file contains 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 |
---|---|---|
@@ -1,74 +1,9 @@ | ||
import fs from 'fs'; | ||
|
||
import axios from 'axios'; | ||
|
||
import { isNotUndefined } from '@poolofdeath20/util'; | ||
|
||
import data from '@periotable/data'; | ||
|
||
import constants from '../../src/web/constant'; | ||
import { obtainNameFromUrl } from '../../src/web/util/asset'; | ||
import element from './element'; | ||
import countries from './countries'; | ||
|
||
const main = () => { | ||
const paths = [ | ||
`public${constants.images.generated.bohr.interactive}`, | ||
`public${constants.images.generated.bohr.static}`, | ||
`public${constants.images.generated.spectrum}`, | ||
].map((path) => { | ||
return `${process.cwd()}/${path}`; | ||
}); | ||
|
||
paths.forEach((path) => { | ||
if (!fs.existsSync(path)) { | ||
fs.mkdirSync(path, { | ||
recursive: true, | ||
}); | ||
} | ||
}); | ||
|
||
Promise.all( | ||
data | ||
.flatMap((element) => { | ||
const { | ||
spectrum, | ||
bohrModel: { interactive, static: nonInteractive }, | ||
} = element; | ||
|
||
const newSpectrum = spectrum?.replace('360', '240'); | ||
|
||
return [ | ||
!interactive | ||
? undefined | ||
: { | ||
name: `${paths[0]}/${obtainNameFromUrl(interactive)}`, | ||
url: interactive, | ||
}, | ||
!nonInteractive | ||
? undefined | ||
: { | ||
name: `${paths[1]}/${obtainNameFromUrl(nonInteractive)}`, | ||
url: nonInteractive, | ||
}, | ||
!newSpectrum | ||
? undefined | ||
: { | ||
name: `${paths[2]}/${obtainNameFromUrl(newSpectrum)}`, | ||
url: newSpectrum, | ||
}, | ||
].filter(isNotUndefined); | ||
}) | ||
.map(async (props) => { | ||
const response = await axios.get(props.url, { | ||
responseType: 'arraybuffer', | ||
}); | ||
|
||
fs.writeFile(props.name, response.data, (error) => { | ||
if (error) { | ||
throw error; | ||
} | ||
}); | ||
}) | ||
); | ||
countries(); | ||
element(); | ||
}; | ||
|
||
main(); |
This file contains 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 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 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.