Skip to content

Commit

Permalink
Fix unstable dialog width in "About track" dialog for multi-quantitat…
Browse files Browse the repository at this point in the history
…ive tracks (#4442)
  • Loading branch information
cmdcolin committed Jun 14, 2024
1 parent 6767498 commit 34e3a45
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 64 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from 'react'
import { makeStyles } from 'tss-react/mui'
import { DataGrid, GridToolbar } from '@mui/x-data-grid'
import { DataGrid, GridColDef, GridToolbar } from '@mui/x-data-grid'
import { Checkbox, FormControlLabel, Typography } from '@mui/material'

// locals
Expand All @@ -10,8 +10,7 @@ import { SanitizedHTML } from '../../ui'

const useStyles = makeStyles()(theme => ({
margin: {
margin: theme.spacing(1),
width: '100%',
marginBottom: theme.spacing(4),
},

cell: {
Expand Down Expand Up @@ -65,10 +64,9 @@ export default function DataGridDetails({
colNames = [...unionKeys]
}
const widths = colNames.map(e => measureGridWidth(rows.map(r => r[e])))

if (unionKeys.size < keys.length + 5) {
return (
<>
<div className={classes.margin}>
<FieldName prefix={prefix} name={name} />
<FormControlLabel
control={
Expand All @@ -79,39 +77,38 @@ export default function DataGridDetails({
}
label={<Typography variant="body2">Show options</Typography>}
/>
<div className={classes.margin}>
<DataGrid
disableRowSelectionOnClick
// @ts-expect-error the rows gets confused by the renderCell of the
// columns below
rows={rows}
rowCount={25}
rowHeight={25}
columnHeaderHeight={35}
hideFooter={rows.length < 25}
slots={{ toolbar: checked ? GridToolbar : null }}
slotProps={{
toolbar: {
printOptions: {
disableToolbarButton: true,
},
},
}}
columns={colNames.map((val, index) => ({
field: val,
renderCell: params => {
const value = params.value as string
return (
<div className={classes.cell}>
<SanitizedHTML html={getStr(value)} />
</div>
)
<DataGrid
disableRowSelectionOnClick
rows={rows}
rowCount={25}
rowHeight={25}
columnHeaderHeight={35}
hideFooter={rows.length < 25}
slots={{ toolbar: checked ? GridToolbar : null }}
slotProps={{
toolbar: {
printOptions: {
disableToolbarButton: true,
},
width: widths[index],
}))}
/>
</div>
</>
},
}}
columns={colNames.map(
(val, index) =>
({
field: val,
renderCell: params => {
const value = params.value as string
return (
<div className={classes.cell}>
<SanitizedHTML html={getStr(value)} />
</div>
)
},
width: widths[index],
}) satisfies GridColDef<(typeof rows)[0]>,
)}
/>
</div>
)
}
return null
Expand Down
95 changes: 68 additions & 27 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
"@aws-sdk/types" "^3.222.0"
tslib "^1.11.1"

"@aws-crypto/crc32@5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@aws-crypto/crc32/-/crc32-5.2.0.tgz#cfcc22570949c98c6689cfcbd2d693d36cdae2e1"
integrity sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==
dependencies:
"@aws-crypto/util" "^5.2.0"
"@aws-sdk/types" "^3.222.0"
tslib "^2.6.2"

"@aws-crypto/crc32c@3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz#016c92da559ef638a84a245eecb75c3e97cb664f"
Expand Down Expand Up @@ -104,6 +113,15 @@
"@aws-sdk/util-utf8-browser" "^3.0.0"
tslib "^1.11.1"

"@aws-crypto/util@^5.2.0":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@aws-crypto/util/-/util-5.2.0.tgz#71284c9cffe7927ddadac793c14f14886d3876da"
integrity sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==
dependencies:
"@aws-sdk/types" "^3.222.0"
"@smithy/util-utf8" "^2.0.0"
tslib "^2.6.2"

"@aws-sdk/client-cloudfront@^3.592.0":
version "3.596.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/client-cloudfront/-/client-cloudfront-3.596.0.tgz#ba361cc28095caf543d5e1e0f40287d2f19b4276"
Expand Down Expand Up @@ -3750,22 +3768,22 @@
"@smithy/url-parser" "^3.0.1"
tslib "^2.6.2"

"@smithy/eventstream-codec@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-codec/-/eventstream-codec-3.0.1.tgz#34fd2f37ddb411fd6a28ff86e0c7c95f813802bd"
integrity sha512-RNl3CuWZWPy+s8sx4PcOkRvlfodR33Dj3hzUuDG/CoF6XBvm5Xvr33wRoC1RWht0NN+Q6Z6KcoAkhlQA12MBBw==
"@smithy/eventstream-codec@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-codec/-/eventstream-codec-3.1.0.tgz#74138287be7e1edd6a72400bb5181f5e1a7b44dd"
integrity sha512-XFDl70ZY+FabSnTX3oQGGYvdbEaC8vPEFkCEOoBkumqaZIwR1WjjJCDu2VMXlHbKWKshefWXdT0NYteL5v6uFw==
dependencies:
"@aws-crypto/crc32" "3.0.0"
"@aws-crypto/crc32" "5.2.0"
"@smithy/types" "^3.1.0"
"@smithy/util-hex-encoding" "^3.0.0"
tslib "^2.6.2"

"@smithy/eventstream-serde-browser@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.1.tgz#8eb486bda0d41324396fed42f471e02bf0a9122e"
integrity sha512-hpjzFlsDwtircebetScjEiwQwwPy0XASsV3dpUxEhPQUnF/mQ/IeiXaDrhsOmJiscMuCwxNPoZm3x4XmnGwN1g==
version "3.0.2"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.2.tgz#342fbdbdf99f8fb7c247024716c5236bffae043e"
integrity sha512-6147vdedQGaWn3Nt4P1KV0LuV8IH4len1SAeycyko0p8oRLWFyYyx0L8JHGclePDSphkjxZqBHtyIfyupCaTGg==
dependencies:
"@smithy/eventstream-serde-universal" "^3.0.1"
"@smithy/eventstream-serde-universal" "^3.0.2"
"@smithy/types" "^3.1.0"
tslib "^2.6.2"

Expand All @@ -3778,20 +3796,20 @@
tslib "^2.6.2"

"@smithy/eventstream-serde-node@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.1.tgz#81b96ee269334516ab23b11c7d0b9a5dc32ae633"
integrity sha512-8ylxIbZ0XiQD8kSKPmrrGS/2LmcDxg1mAAURa5tjcjYeBJPg7EaFRcH/aRe2RDPaoVUAbOfjHh2bTkWvy7P4Ig==
version "3.0.2"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.2.tgz#fff9e92983c97f07174c1bbcf7f1af47fc478a6e"
integrity sha512-DLtmGAfqxZAql8rB+HqyPlUne22u3EEVj+hxlUjgXk0hXt+SfLGK0ljzRFmiWQ3qGpHu1NdJpJA9e5JE/dJxFw==
dependencies:
"@smithy/eventstream-serde-universal" "^3.0.1"
"@smithy/eventstream-serde-universal" "^3.0.2"
"@smithy/types" "^3.1.0"
tslib "^2.6.2"

"@smithy/eventstream-serde-universal@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.1.tgz#0060ce4147568706988890490e8c6cc11a15dde9"
integrity sha512-E6aeN0MEO1p1KVN4Z3XQlvdUPp+hKJ21eiiioWtNLNNGAZUaJPlXgrqF+6Wj/aM86//9EQp6/iAwQB6eXaulzw==
"@smithy/eventstream-serde-universal@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.2.tgz#d1704c14b0a691d0d8b4f68def68adaa20bb96d8"
integrity sha512-d3SgAIQ/s4EbU8HAHJ8m2MMJPAL30nqJktyVgvqZWNznA8PJl61gJw5gj/yjIt/Fvs3d4fU8FmPPAhdp2yr/7A==
dependencies:
"@smithy/eventstream-codec" "^3.0.1"
"@smithy/eventstream-codec" "^3.1.0"
"@smithy/types" "^3.1.0"
tslib "^2.6.2"

Expand All @@ -3807,9 +3825,9 @@
tslib "^2.6.2"

"@smithy/hash-blob-browser@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/hash-blob-browser/-/hash-blob-browser-3.0.1.tgz#9a72d6010bad91f2f6b97df41bbe662b24d404f3"
integrity sha512-P8xxvMm0F6vi/7+GwGhZbE532b7TzGJUfUoUNGrb+dcR+MJUisV8sEQBZ5EB/ddf1/aGr8KO7QqbO/6WhfdW/Q==
version "3.1.0"
resolved "https://registry.yarnpkg.com/@smithy/hash-blob-browser/-/hash-blob-browser-3.1.0.tgz#0002113c3214e1d4fef2c489ac7b15d0b141d2af"
integrity sha512-lKEHDN6bLzYdx5cFmdMHfYVmmTZTmjphwPBSumgkaniEYwRAXnbDEGETeuzfquS9Py1aH6cmqzXWxxkD7mV3sA==
dependencies:
"@smithy/chunked-blob-reader" "^3.0.0"
"@smithy/chunked-blob-reader-native" "^3.0.0"
Expand All @@ -3827,9 +3845,9 @@
tslib "^2.6.2"

"@smithy/hash-stream-node@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/hash-stream-node/-/hash-stream-node-3.0.1.tgz#88f467cb35f87fa2154774ac56d901cf13321edd"
integrity sha512-5Z5Oyqh9f5927HWyKK3klG09rMlVu8OcEQd4YDxYZbjdB9nHd8imTMN06tfcyrZCEzcOdeUCpJmjfVWUxUDigg==
version "3.1.0"
resolved "https://registry.yarnpkg.com/@smithy/hash-stream-node/-/hash-stream-node-3.1.0.tgz#80fbd12b223869862e6ab3aecc5a8fb7064b884e"
integrity sha512-OkU9vjN17yYsXTSrouctZn2iYwG4z8WSc7F50+9ogG2crOtMopkop+22j35tX2ry2i/vLRCYgnqEmBWfvnYT2g==
dependencies:
"@smithy/types" "^3.1.0"
"@smithy/util-utf8" "^3.0.0"
Expand All @@ -3843,6 +3861,13 @@
"@smithy/types" "^3.1.0"
tslib "^2.6.2"

"@smithy/is-array-buffer@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz#f84f0d9f9a36601a9ca9381688bd1b726fd39111"
integrity sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==
dependencies:
tslib "^2.6.2"

"@smithy/is-array-buffer@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz#9a95c2d46b8768946a9eec7f935feaddcffa5e7a"
Expand Down Expand Up @@ -3982,9 +4007,9 @@
tslib "^2.6.2"

"@smithy/signature-v4@^3.0.0":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-3.0.1.tgz#8542bfe127f93a8c2c5bcdc05c3e489b9cd16ed5"
integrity sha512-ARAmD+E7j6TIEhKLjSZxdzs7wceINTMJRN2BXPM09BiUmJhkXAF1ZZtDXH6fhlk7oehBZeh37wGiPOqtdKjLeg==
version "3.1.0"
resolved "https://registry.yarnpkg.com/@smithy/signature-v4/-/signature-v4-3.1.0.tgz#cc819568c4fcbadce107901680a96e662bccc86a"
integrity sha512-m0/6LW3IQ3/JBcdhqjpkpABPTPhcejqeAn0U877zxBdNLiWAnG2WmCe5MfkUyVuvpFTPQnQwCo/0ZBR4uF5kxg==
dependencies:
"@smithy/is-array-buffer" "^3.0.0"
"@smithy/types" "^3.1.0"
Expand Down Expand Up @@ -4045,6 +4070,14 @@
dependencies:
tslib "^2.6.2"

"@smithy/util-buffer-from@^2.2.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz#6fc88585165ec73f8681d426d96de5d402021e4b"
integrity sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==
dependencies:
"@smithy/is-array-buffer" "^2.2.0"
tslib "^2.6.2"

"@smithy/util-buffer-from@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz#559fc1c86138a89b2edaefc1e6677780c24594e3"
Expand Down Expand Up @@ -4138,6 +4171,14 @@
dependencies:
tslib "^2.6.2"

"@smithy/util-utf8@^2.0.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-2.3.0.tgz#dd96d7640363259924a214313c3cf16e7dd329c5"
integrity sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==
dependencies:
"@smithy/util-buffer-from" "^2.2.0"
tslib "^2.6.2"

"@smithy/util-utf8@^3.0.0":
version "3.0.0"
resolved "https://registry.yarnpkg.com/@smithy/util-utf8/-/util-utf8-3.0.0.tgz#1a6a823d47cbec1fd6933e5fc87df975286d9d6a"
Expand Down

0 comments on commit 34e3a45

Please sign in to comment.