Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui-common): fix matrices display issues #1960

Merged
merged 5 commits into from
Mar 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix(results): adjust date times for accurate frequency display
hdinia committed Mar 4, 2024
commit 0d6f013cd19b5be65f2ba601b97ddda06b5837dc
Original file line number Diff line number Diff line change
@@ -153,11 +153,36 @@ function ResultDetails() {
const dateTimeFromIndex = useMemo(() => {
if (!matrixRes.data) return [];

return matrixRes.data.index.map((dateTime) => {
const parsedDate = moment(dateTime, "MM/DD HH:mm");
return parsedDate.format("ddd D MMM HH:mm");
});
}, [matrixRes.data]);
// Annual format has a static string
if (timestep === Timestep.Annual) {
return ["Annual"];
}

// Original date/time format mapping for moment parsing
const parseFormat = {
[Timestep.Hourly]: "MM/DD HH:mm",
[Timestep.Daily]: "MM/DD",
[Timestep.Weekly]: "WW",
[Timestep.Monthly]: "MM",
}[timestep];

// Output formats for each timestep to match legacy UI requirements
const outputFormat = {
[Timestep.Hourly]: "DD MMM HH:mm I",
[Timestep.Daily]: "DD MMM I",
[Timestep.Weekly]: "WW",
[Timestep.Monthly]: "MMM",
}[timestep];

const needsIndex =
timestep === Timestep.Hourly || timestep === Timestep.Daily;

return matrixRes.data.index.map((dateTime, i) =>
moment(dateTime, parseFormat).format(
outputFormat.replace("I", needsIndex ? ` - ${i + 1}` : ""),
),
);
}, [matrixRes.data, timestep]);

////////////////////////////////////////////////////////////////
// Event Handlers

Unchanged files with check annotations Beta

import ConfirmationDialog from "../../../../../common/dialogs/ConfirmationDialog";
import LinearProgressWithLabel from "../../../../../common/LinearProgressWithLabel";
export const ColorStatus = {

Check warning on line 33 in webapp/src/components/App/Singlestudy/HomeView/InformationView/LauncherHistory/JobStepper.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
running: "warning.main",
pending: "grey.400",
success: "success.main",
apiRef?: React.Ref<UseFormReturnPlus<TFieldValues, TContext> | undefined>;
}
export function useFormContextPlus<TFieldValues extends FieldValues>() {

Check warning on line 86 in webapp/src/components/common/Form/index.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Use a new file to share constants or functions between components
return useFormContextOriginal() as UseFormReturnPlus<TFieldValues>;
}
};
}
function BooleanFE(props: BooleanFEProps) {

Check warning on line 32 in webapp/src/components/common/fieldEditors/BooleanFE.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
const {
defaultValue,
value,
);
}
export default reactHookFormSupport({ defaultValue: false })(BooleanFE);

Check warning on line 65 in webapp/src/components/common/fieldEditors/BooleanFE.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh can't handle anonymous components. Add a name to your export
helperText?: React.ReactNode;
}
function CheckBoxFE(props: CheckBoxFEProps) {

Check warning on line 21 in webapp/src/components/common/fieldEditors/CheckBoxFE.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
const {
value,
defaultValue,
);
}
export default reactHookFormSupport({ defaultValue: false })(CheckBoxFE);

Check warning on line 58 in webapp/src/components/common/fieldEditors/CheckBoxFE.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh can't handle anonymous components. Add a name to your export
// TODO Add `onChange`'s value in `inputRef` and `onBlur`'s event
function CheckboxesTagsFE<

Check warning on line 45 in webapp/src/components/common/fieldEditors/CheckboxesTagsFE.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
T,
DisableClearable extends boolean | undefined = undefined,
FreeSolo extends boolean | undefined = undefined,
defaultValue?: string;
};
function ColorPickerFE(props: ColorPickerFEProps) {

Check warning on line 19 in webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
const { value, defaultValue, onChange, sx, inputRef, ...textFieldProps } =
props;
const [currentColor, setCurrentColor] = useState(defaultValue || value || "");
);
}
export default reactHookFormSupport({ defaultValue: "" })(ColorPickerFE);

Check warning on line 116 in webapp/src/components/common/fieldEditors/ColorPickerFE/index.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh can't handle anonymous components. Add a name to your export
helperText?: string;
}
function ListFE<TItem, TOption>(props: ListFEProps<TItem, TOption>) {

Check warning on line 62 in webapp/src/components/common/fieldEditors/ListFE/index.tsx

GitHub Actions / npm-test (ubuntu-20.04)

Fast refresh only works when a file only exports components. Move your component(s) to a separate file
const {
value,
defaultValue,