mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-12-05 03:37:41 +00:00
Refactor EventTile using the MVVM pattern - #7a (#33640)
* Make EventTileViewModel an owned root VM * Move timestamp sub-VMs under EventTileViewModel * Move thread-list action bar VM under EventTileViewModel * Clean up for improved readability * Clean up to avoid duplicate EventTile render derivations * Avoid mutating EventTileViewModel during render * Move EventTile child VM syncing into adapters * Replace timestamp VM field setters with batched setProps * Component wrappers at the end of the file * Lazy-create EventTile child view models
This commit is contained in:
@@ -647,15 +647,7 @@ export const DownloadButton: React.FC<DownloadButtonProps> = ({ url, fileName, m
|
||||
function MessageTimestampWrapper(props: MessageTimestampViewModelProps): JSX.Element {
|
||||
const vm = useCreateAutoDisposedViewModel(() => new MessageTimestampViewModel(props));
|
||||
useEffect(() => {
|
||||
vm.setTimestamp(props.ts);
|
||||
vm.setDisplayOptions({
|
||||
showTwelveHour: props.showTwelveHour,
|
||||
showFullDate: props.showFullDate,
|
||||
showSeconds: props.showSeconds,
|
||||
});
|
||||
vm.setTooltipInhibited(props.inhibitTooltip);
|
||||
vm.setHref(props.href);
|
||||
vm.setHandlers({ onClick: props.onClick });
|
||||
vm.setProps(props);
|
||||
}, [vm, props]);
|
||||
return <MessageTimestampView vm={vm} className="mx_MessageTimestamp" />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user