Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
earth-in-flux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
VizLab
earth-in-flux
Commits
efa31089
Commit
efa31089
authored
2 weeks ago
by
Azadpour, Elmera
Browse files
Options
Downloads
Patches
Plain Diff
add more info in spec/fam box
parent
5d5040de
No related branches found
No related tags found
1 merge request
!95
top 25 fams, white stroke on circle text, img/text for fams
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/components/FamilyInfoBox.vue
+95
-38
95 additions, 38 deletions
src/components/FamilyInfoBox.vue
src/components/FishAsFoodCirclePackingViz.vue
+30
-15
30 additions, 15 deletions
src/components/FishAsFoodCirclePackingViz.vue
with
125 additions
and
53 deletions
src/components/FamilyInfoBox.vue
+
95
−
38
View file @
efa31089
<
template
>
<div
class=
"info-box"
>
<figure
v-if=
"activeFamily"
>
<img
:src=
"activeFamily.image"
alt=
"Family illustration"
/>
<figcaption
v-html=
"activeFamily.caption"
></figcaption>
</figure>
<p>
{{
activeFamily
.
text
}}
</p>
<div
class=
"info-box"
v-if=
"activeFamily"
>
<!-- FAMILY LEVEL -->
<div
v-if=
"activeFamily.type === 'family' || !activeFamily.type"
class=
"family-content"
>
<figure>
<img
:src=
"activeFamily.image"
alt=
"Fish silhouette"
/>
<figcaption
v-if=
"activeFamily.caption"
v-html=
"activeFamily.caption"
></figcaption>
</figure>
<div
class=
"family-text"
>
<h2
v-if=
"activeFamily.name"
>
{{
activeFamily
.
name
}}
</h2>
<p
v-if=
"activeFamily.economicValue"
><strong>
{{
activeFamily
.
economicValue
}}
</strong>
in total economic value
</p>
<p
v-if=
"activeFamily.speciesCount"
><strong>
{{
activeFamily
.
speciesCount
}}
</strong>
species that are recreationally fished
</p>
<p>
{{
activeFamily
.
text
}}
</p>
</div>
</div>
<!-- SPECIES LEVEL -->
<div
v-else-if=
"activeFamily.type === 'species'"
class=
"species-content"
>
<div
class=
"species-header"
>
<img
:src=
"activeFamily.image"
alt=
"Fish silhouette small"
class=
"species-icon"
/>
<span
class=
"family-label"
>
{{
activeFamily
.
family
}}
</span>
</div>
<hr
/>
<h2>
{{
activeFamily
.
name
}}
</h2>
<p
class=
"species-subtitle"
>
Species
</p>
<p><strong>
{{
activeFamily
.
economicValue
}}
</strong>
in total economic value
</p>
<p><strong>
{{
activeFamily
.
countryCount
}}
</strong>
countries where it is recreationally fished
</p>
</div>
</div>
</
template
>
...
...
@@ -21,38 +43,73 @@
</
script
>
<
style
scoped
>
.info-box
{
background-color
:
#f8f9fa
;
padding
:
2rem
;
border-radius
:
12px
;
margin-bottom
:
2rem
;
margin-top
:
2rem
;
display
:
flex
;
gap
:
4rem
;
align-items
:
center
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0.2
);
}
img
{
width
:
300px
;
height
:
auto
;
object-fit
:
contain
;
.info-box
{
background-color
:
#f8f9fa
;
padding
:
2rem
;
border-radius
:
12px
;
margin-bottom
:
2rem
;
margin-top
:
2rem
;
box-shadow
:
0
2px
8px
rgba
(
0
,
0
,
0
,
0.2
);
display
:
block
;
}
.family-content
{
display
:
flex
;
align-items
:
center
;
gap
:
2rem
;
}
.family-text
{
max-width
:
600px
;
font-size
:
1.4rem
;
}
img
{
width
:
300px
;
height
:
auto
;
object-fit
:
contain
;
border-radius
:
8px
;
}
figcaption
{
margin-top
:
0.5rem
;
font-size
:
1.4rem
;
color
:
#666
;
line-height
:
1.2
;
max-width
:
350px
;
text-align
:
center
;
}
p
{
margin
:
0
;
font-size
:
1.4rem
;
line-height
:
1.4
;
}
}
figcaption
{
margin-top
:
0.5rem
;
font-size
:
1.15rem
;
color
:
#666
;
text-align
:
center
;
}
.species-content
{
display
:
flex
;
flex-direction
:
column
;
font-size
:
1.4rem
}
.species-header
{
display
:
flex
;
align-items
:
center
;
gap
:
1rem
;
}
.species-icon
{
width
:
100px
;
}
.family-label
{
font-size
:
1.4rem
;
color
:
#333
;
}
.species-subtitle
{
font-size
:
1.4rem
;
color
:
#666
;
margin-bottom
:
0.5rem
;
}
.species-content
hr
{
margin-top
:
1rem
;
margin-bottom
:
0.5rem
}
</
style
>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/FishAsFoodCirclePackingViz.vue
+
30
−
15
View file @
efa31089
...
...
@@ -48,7 +48,7 @@
const
darkBlue
=
bodyCSS
.
getPropertyValue
(
'
--dark-blue
'
);
const
familyInfo
=
props
.
text
.
familyInfo
;
const
defaultFamily
=
props
.
text
.
defaultFamily
;
const
activeFamily
=
ref
(
defaultFamily
);
const
activeFamily
=
ref
(
props
.
text
.
defaultFamily
);
// Declare behavior on mounted
// functions called here
...
...
@@ -182,22 +182,37 @@
});
let
current
=
d
;
let
foundFamily
=
null
;
while
(
current
)
{
const
name
=
current
.
data
?.
name
;
if
(
name
&&
familyInfo
[
name
])
{
foundFamily
=
name
;
break
;
}
current
=
current
.
parent
;
let
infoObj
=
null
;
let
level
=
d
.
depth
;
if
(
level
===
1
&&
familyInfo
[
d
.
data
.
name
])
{
// family level
const
familyData
=
familyInfo
[
d
.
data
.
name
];
infoObj
=
{
type
:
"
family
"
,
name
:
d
.
data
.
name
,
image
:
familyData
.
image
,
text
:
familyData
.
text
,
caption
:
familyData
.
caption
,
economicValue
:
d3
.
format
(
"
$.1s
"
)(
d
.
value
).
replace
(
"
G
"
,
"
B
"
),
speciesCount
:
d
.
children
?
d
.
children
.
length
:
0
};
}
else
if
(
level
===
2
)
{
// species level
const
familyName
=
d
.
parent
?.
data
?.
name
;
const
silhouette
=
familyInfo
[
familyName
]?.
image
;
infoObj
=
{
type
:
"
species
"
,
name
:
d
.
data
.
name
,
family
:
familyName
,
image
:
silhouette
,
economicValue
:
d3
.
format
(
"
$.1s
"
)(
d
.
value
).
replace
(
"
G
"
,
"
B
"
),
countryCount
:
d
.
children
?
d
.
children
.
length
:
0
};
}
if
(
foundFamily
)
{
activeFamily
.
value
=
familyInfo
[
foundFamily
];
}
else
{
activeFamily
.
value
=
defaultFamily
;
}
activeFamily
.
value
=
infoObj
||
defaultFamily
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment