Skip to content

Commit 82d7577

Browse files
committed
improving UI for challenge display
1 parent 6206821 commit 82d7577

3 files changed

Lines changed: 28 additions & 28 deletions

File tree

py-src/data_formulator/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_example_dataset_list():
5959
example_datasets = [
6060
{"name": "gapminder", "challenges": [
6161
{"text": "Create a line chart to show the life expectancy trend of each country over time.", "difficulty": "easy"},
62-
{"text": "What's the 10 countries with highest life expectancy in 2005?", "difficulty": "medium"},
62+
{"text": "Visualize the top 10 countries with highest life expectancy in 2005.", "difficulty": "medium"},
6363
{"text": "Find top 10 countries that have the biggest difference of life expectancy in 1955 and 2005.", "difficulty": "hard"},
6464
{"text": "Rank countries by their average population per decade. Then only show countries with population over 50 million in 2005.", "difficulty": "hard"}
6565
]},
@@ -83,7 +83,7 @@ def get_example_dataset_list():
8383
]},
8484
{"name": "unemployment-across-industries", "challenges": [
8585
{"text": "Create a scatter plot to show the relationship between unemployment rate and year.", "difficulty": "easy"},
86-
{"text": "Create a line chart to show the average unemployment per year for each industry", "difficulty": "medium"},
86+
{"text": "Create a line chart to show the average unemployment per year for each industry.", "difficulty": "medium"},
8787
{"text": "Find the 5 most stable industries (least change in unemployment rate between 2000 and 2010) and visualize their trend over time using line charts.", "difficulty": "medium"},
8888
{"text": "Create a bar chart to show the unemployment rate change between 2000 and 2010, and highlight the top 5 most stable industries with least change.", "difficulty": "hard"}
8989
]}

src/views/MessageSnackbar.tsx

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,19 @@ export function MessageSnackbar() {
7070
<Box>
7171
<Tooltip placement="right" title="view challenges">
7272
<IconButton
73+
color="warning"
7374
disabled={challenges.length === 0}
7475
sx={{
7576
position: "absolute",
7677
bottom: 56,
77-
right: 0,
78+
right: 8,
7879
animation: challenges.length > 0 ? 'glow 1.5s ease-in-out infinite alternate' : 'none',
7980
'@keyframes glow': {
8081
from: {
81-
boxShadow: '0 0 5px #fff, 0 0 10px #fff, 0 0 15px #1976d2'
82+
boxShadow: '0 0 5px #fff, 0 0 10px #fff, 0 0 15px #ed6c02'
8283
},
8384
to: {
84-
boxShadow: '0 0 10px #fff, 0 0 20px #fff, 0 0 30px #1976d2'
85+
boxShadow: '0 0 10px #fff, 0 0 20px #fff, 0 0 30px #ed6c02'
8586
}
8687
}
8788
}}
@@ -90,29 +91,35 @@ export function MessageSnackbar() {
9091
<AssignmentIcon />
9192
</IconButton>
9293
</Tooltip>
93-
<Tooltip placement="right" title="view last message"><IconButton disabled={messages.length == 0} sx={{position: "absolute", bottom: 16, right: 0}}
94-
onClick={()=>{
95-
setOpen(true);
96-
setMessage(messages[messages.length - 1]);
97-
}}><InfoIcon /></IconButton></Tooltip>
94+
<Tooltip placement="right" title="view last message">
95+
<IconButton disabled={messages.length == 0} sx={{position: "absolute", bottom: 16, right: 8}}
96+
onClick={()=>{
97+
setOpen(true);
98+
setMessage(messages[messages.length - 1]);
99+
}}
100+
>
101+
<InfoIcon />
102+
</IconButton>
103+
</Tooltip>
98104
{challenge != undefined ? <Snackbar
99105
open={openChallenge}
100106
anchorOrigin={{vertical: 'bottom', horizontal: 'right'}}
101107
sx={{maxWidth: '400px'}}
102108
>
103109
<Paper sx={{
104110
width: '100%',
105-
bgcolor: 'rgb(237,244,251)',
111+
bgcolor: 'white',
106112
color: 'text.primary',
107113
p: 2,
108-
boxShadow: 1,
114+
boxShadow: 2,
109115
borderRadius: 1,
116+
border: '1px solid #e0e0e0',
110117
display: 'flex',
111118
flexDirection: 'column'
112119
}}>
113120
<Box sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 1}}>
114121
<Typography variant="subtitle1" sx={{fontWeight: 'bold', fontSize: 14}}>
115-
Visualization Challenges for <Box component="span" sx={{fontWeight: 'bold', color: 'primary.main'}}>{challenge.tableId}</Box>
122+
Visualization challenges for dataset <Box component="span" sx={{fontWeight: 'bold', color: 'primary.main'}}>{challenge.tableId}</Box>
116123
</Typography>
117124
<IconButton
118125
size="small"
@@ -130,11 +137,9 @@ export function MessageSnackbar() {
130137
sx={{
131138
fontSize: 12,
132139
marginBottom: 1,
133-
color: ch.difficulty === 'easy'
134-
? '#2e7d32'
135-
: ch.difficulty === 'medium'
136-
? '#f57c00'
137-
: '#d32f2f'
140+
color: ch.difficulty === 'easy' ? 'success.main'
141+
: ch.difficulty === 'medium' ? 'warning.main'
142+
: 'error.main'
138143
}}
139144
>
140145
<Box

src/views/TableSelectionView.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,11 @@ export const TableSelectionView: React.FC<TableSelectionViewProps> = function Ta
123123
}})
124124

125125
let challengeView = <Box sx={{margin: "6px 0px"}}>
126-
<Typography variant="subtitle2" sx={{marginLeft: "6px", fontSize: 12}}>Try these data visualizationchallenges with this dataset:</Typography>
127-
{tc.challenges.map((c, j) => <Box key={j} sx={{display: 'flex', alignItems: 'flex-start', pl: 2}}>
128-
<Box component="span" sx={{display: 'inline-block', width: '6px', height: '6px',
129-
borderRadius: '50%', mr: 1, mt: 1,
130-
bgcolor: c.difficulty === 'easy' ? '#2e7d32' :
131-
c.difficulty === 'medium' ? '#f57c00' :
132-
'#d32f2f'}} />
133-
<Typography sx={{fontSize: 11, color: c.difficulty === 'easy' ? '#2e7d32' :
134-
c.difficulty === 'medium' ? '#f57c00' :
135-
'#d32f2f'}}>[{c.difficulty}] {c.text}</Typography>
126+
<Typography variant="subtitle2" sx={{marginLeft: "6px", fontSize: 12}}>Try these data visualization challenges with this dataset:</Typography>
127+
{tc.challenges.map((c, j) => <Box key={j} sx={{display: 'flex', alignItems: 'flex-start', pl: 1}}>
128+
<Typography sx={{fontSize: 11, color: c.difficulty === 'easy' ? 'success.main' :
129+
c.difficulty === 'medium' ? 'warning.main' :
130+
'error.main'}}>[{c.difficulty}] {c.text}</Typography>
136131
</Box>)}
137132
</Box>
138133

0 commit comments

Comments
 (0)