Skip to content

Commit cbaf700

Browse files
committed
Merge
2 parents c13c68c + 5540c80 commit cbaf700

File tree

13 files changed

+1729
-1577
lines changed

13 files changed

+1729
-1577
lines changed

plugins/circular-view/src/CircularView/components/Ruler.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,7 @@ const RulerLabel = observer(function ({
124124
const textXY = polarToCartesian(radiusPx + 5, radians)
125125
if (!text) {
126126
return null
127-
}
128-
129-
if (text.length * 6.5 < maxWidthPx) {
127+
} else if (text.length * 6.5 < maxWidthPx) {
130128
// text is rotated parallel to the ruler arc
131129
return (
132130
<text
@@ -142,8 +140,7 @@ const RulerLabel = observer(function ({
142140
<title>{title || text}</title>
143141
</text>
144142
)
145-
}
146-
if (maxWidthPx > 4) {
143+
} else if (maxWidthPx > 4) {
147144
// text is rotated perpendicular to the ruler arc
148145
const overallRotation = radToDeg(radians + view.offsetRadians - Math.PI / 2)
149146
if (overallRotation >= 180) {
@@ -176,10 +173,10 @@ const RulerLabel = observer(function ({
176173
<title>{title || text}</title>
177174
</text>
178175
)
176+
} else {
177+
// if you get here there is no room for the text at all
178+
return null
179179
}
180-
181-
// if you get here there is no room for the text at all
182-
return null
183180
})
184181

185182
const RegionRulerArc = observer(function ({
Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import StarIcon2 from '@mui/icons-material/Star'
1+
import Star from '@mui/icons-material/Star'
2+
import StarBorder from '@mui/icons-material/StarBorder'
23
import { Tooltip } from '@mui/material'
34
import { makeStyles } from 'tss-react/mui'
45

@@ -7,14 +8,31 @@ const useStyles = makeStyles()({
78
marginLeft: 4,
89
fontSize: 16,
910
color: 'darkorange',
11+
cursor: 'pointer',
12+
},
13+
starIconEmpty: {
14+
marginLeft: 4,
15+
fontSize: 16,
16+
color: 'black',
17+
cursor: 'pointer',
1018
},
1119
})
1220

13-
export default function StarIcon() {
21+
export default function StarIcon({
22+
isFavorite,
23+
onClick,
24+
}: {
25+
isFavorite: boolean
26+
onClick: () => void
27+
}) {
1428
const { classes } = useStyles()
1529
return (
1630
<Tooltip title="Favorite">
17-
<StarIcon2 className={classes.starIcon} />
31+
{isFavorite ? (
32+
<Star className={classes.starIcon} onClick={onClick} />
33+
) : (
34+
<StarBorder className={classes.starIconEmpty} onClick={onClick} />
35+
)}
1836
</Tooltip>
1937
)
2038
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import { MenuItem, TextField } from '@mui/material'
2+
import { makeStyles } from 'tss-react/mui'
3+
4+
const useStyles = makeStyles()({
5+
root: {
6+
margin: 0,
7+
marginLeft: 10,
8+
},
9+
})
10+
11+
interface CategorySelectorProps {
12+
allTypes?: { categories: { key: string; title: string; url: string }[] }
13+
typeOption: string
14+
allTypesLoading: boolean
15+
allTypesError?: unknown
16+
onChange: (value: string) => void
17+
}
18+
19+
export default function CategorySelector({
20+
allTypes,
21+
typeOption,
22+
allTypesLoading,
23+
allTypesError,
24+
onChange,
25+
}: CategorySelectorProps) {
26+
const { classes } = useStyles()
27+
28+
if (!allTypes) {
29+
return null
30+
}
31+
32+
return (
33+
<TextField
34+
select
35+
name="typeOption"
36+
label="Group"
37+
variant="outlined"
38+
className={classes.root}
39+
value={typeOption}
40+
disabled={allTypesLoading}
41+
onChange={event => {
42+
onChange(event.target.value)
43+
}}
44+
helperText={
45+
allTypesLoading
46+
? 'Loading categories...'
47+
: allTypesError
48+
? 'Using cached categories'
49+
: ''
50+
}
51+
>
52+
{allTypes.categories.map(({ key, title }) => (
53+
<MenuItem key={key} value={key}>
54+
{title}
55+
</MenuItem>
56+
))}
57+
</TextField>
58+
)
59+
}

0 commit comments

Comments
 (0)