Commit 9fc84ed1 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Updated the button style and made the prompt only show up once per entry.

parent 8535405f
Pipeline #84950 passed with stages
in 25 minutes and 37 seconds
......@@ -97,7 +97,7 @@ export function ErrorCard({message, className, classes, actions}) {
</Typography>
{actions
? <Box className={style.actions}>
{actions.map((action) => <Button key={action.label} variant="contained" color="primary" onClick={action.onClick}>
{actions.map((action) => <Button key={action.label} onClick={action.onClick}>
{action.label}
</Button>
)}
......
......@@ -407,15 +407,6 @@ function Overview({section, def}) {
return ''
}
const nAtoms = section.atom_species.length
const sizeLimit = 300
if (nAtoms >= sizeLimit && !warningIgnored) {
return <ErrorCard
message={`Visualization is by default disabled for systems with more than ${sizeLimit} atoms. Do you wish to enable visualization for this system with ${nAtoms} atoms?`}
className={style.error}
actions={[{label: 'Yes', onClick: e => setWarningIgnored(true)}]}
>
</ErrorCard>
}
// Loading exact same system, no need to reload visualizer
if (sectionPath === visualizedSystem.sectionPath && index === visualizedSystem.index) {
// Loading same system with different positions
......@@ -424,8 +415,19 @@ function Overview({section, def}) {
system = {
positions: convertSI(section.atom_positions, 'meter', {length: 'angstrom'}, false)
}
// Completely new system
// Loading a completely new system. When trying to visualize the system for
// the first time, check the system size and for large systems ask the user
// for permission.
} else {
const sizeLimit = 300
if (nAtoms >= sizeLimit && !warningIgnored) {
return <ErrorCard
message={`Visualization is by default disabled for systems with more than ${sizeLimit} atoms. Do you wish to enable visualization for this system with ${nAtoms} atoms?`}
className={style.error}
actions={[{label: 'Yes', onClick: e => setWarningIgnored(true)}]}
>
</ErrorCard>
}
system = {
'species': section.atom_species,
'cell': convertSI(section.lattice_vectors, 'meter', {length: 'angstrom'}, false),
......
......@@ -1287,10 +1287,10 @@
resolved "https://registry.yarnpkg.com/@kyleshockey/object-assign-deep/-/object-assign-deep-0.4.2.tgz#84900f0eefc372798f4751b5262830b8208922ec"
integrity sha1-hJAPDu/DcnmPR1G1JigwuCCJIuw=
 
"@lauri-codes/materia@0.0.6":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@lauri-codes/materia/-/materia-0.0.6.tgz#b1a64ef174fc0f4107940f9ca19ec8a2305d7376"
integrity sha512-RAC8iRS430f6pNum6zlK/PuFgENO1mOM1C1VSE6v+Hv1u8J9FDOyULvhyVuKdqOB6Gh6bmQikPBWX0+XGeFynw==
"@lauri-codes/materia@0.0.7":
version "0.0.7"
resolved "https://registry.yarnpkg.com/@lauri-codes/materia/-/materia-0.0.7.tgz#7580526874420641e26ab00bf0412d2a803d2cda"
integrity sha512-G3d4kRBNG4rYsLKceiW7Uhqy/uX0PFo70tsOIDZnOiNAICSIFF62LbYLDVHKgJf35xtyQM0kvM1WQGKgL9tmIw==
dependencies:
three "^0.119.1"
threejs-meshline "^2.0.11"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment