-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3377 from opral/lixfm-1-checkpoint-timeline
Add LIXFM–1 checkpoint timeline
- Loading branch information
Showing
26 changed files
with
2,504 additions
and
1,336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
"lix-file-manager": patch | ||
"@lix-js/plugin-csv": patch | ||
"@lix-js/sdk": patch | ||
--- | ||
|
||
@lix-js/sdk: | ||
- define UiDiffComponent type | ||
- diff components can now consume multiple diffs | ||
|
||
@lix-js/plugin-csv: | ||
- update to use new diff component type | ||
- display multiple diffs in a single component | ||
- add rowId to snapshot content | ||
- group diffs by rowId | ||
|
||
lix-file-manager: | ||
- add checkpoint timeline instead of change list | ||
- refactor API diff component rendering | ||
- refactor queries to use new UiDiffComponent type | ||
|
||
PR URL: | ||
https://github.com/opral/monorepo/pull/3377 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
192 changes: 0 additions & 192 deletions
192
packages/lix-file-manager/src/components/ChangeComponent.tsx
This file was deleted.
Oops, something went wrong.
51 changes: 51 additions & 0 deletions
51
packages/lix-file-manager/src/components/ChangeDiffComponent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useEffect, useState } from "react"; | ||
import { UiDiffComponentProps } from "@lix-js/sdk"; | ||
import { lixAtom } from "@/state.ts"; | ||
import { useAtom } from "jotai/react"; | ||
import clsx from "clsx"; | ||
|
||
export const ChangeDiffComponent = (props: { | ||
diffs: UiDiffComponentProps["diffs"]; | ||
className?: string; | ||
}) => { | ||
const [lix] = useAtom(lixAtom); | ||
const [isComponentLoaded, setIsComponentLoaded] = useState(false); | ||
|
||
const pluginKey = props.diffs[0]?.plugin_key; | ||
const CustomElementName = `diff-${pluginKey.replace(/_/g, "-")}`; | ||
|
||
useEffect(() => { | ||
const loadDiffComponent = async () => { | ||
const component = (await lix.plugin.getAll()).find( | ||
(p) => p.key === pluginKey | ||
)?.diffUiComponent; | ||
|
||
if (!customElements.get(CustomElementName)) { | ||
if (component) { | ||
customElements.define(CustomElementName, component); | ||
setIsComponentLoaded(true); | ||
} else { | ||
console.warn(`No diff UI component found for plugin key '${pluginKey}'`); | ||
// Fallback logic | ||
} | ||
} else { | ||
setIsComponentLoaded(true); | ||
} | ||
}; | ||
|
||
loadDiffComponent(); | ||
}, [lix, pluginKey]); | ||
|
||
if (!isComponentLoaded) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div className={clsx("w-full overflow-x-auto pb-4", props.className)}> | ||
<CustomElementName | ||
// @ts-expect-error - Custom element props | ||
diffs={props.diffs} | ||
/> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.