mirror of
https://github.com/20kaushik02/spotify-manager-web.git
synced 2025-12-06 08:04:06 +00:00
partial opn result
This commit is contained in:
parent
70ee8c6b0e
commit
1e46c087d6
@ -38,15 +38,16 @@ interface deleteLinkDataType extends apiRespBaseType {}
|
||||
type backfillLinkBodyType = createLinkBodyType;
|
||||
|
||||
interface backfillLinkDataType extends apiRespBaseType {
|
||||
added?: number;
|
||||
local?: number;
|
||||
toAddNum: number;
|
||||
addedNum: number;
|
||||
localNum: number;
|
||||
}
|
||||
|
||||
type pruneLinkBodyType = createLinkBodyType;
|
||||
|
||||
interface pruneLinkDataType extends apiRespBaseType {
|
||||
added?: number;
|
||||
local?: number;
|
||||
toDelNum: number;
|
||||
deletedNum: number;
|
||||
}
|
||||
|
||||
export const apiFetchGraph = async (): Promise<
|
||||
|
||||
@ -96,13 +96,13 @@ const initialInteractive: Interactive = {
|
||||
elsSel: true,
|
||||
};
|
||||
|
||||
const nodeOptions: Partial<Node> = {
|
||||
const nodeProps: Partial<Node> = {
|
||||
style: {
|
||||
backgroundColor: "white",
|
||||
},
|
||||
};
|
||||
|
||||
const selectedNodeOptions: Partial<Node> = {
|
||||
const selectedNodeProps: Partial<Node> = {
|
||||
style: {
|
||||
backgroundColor: "white",
|
||||
boxShadow: "0px 0px 60px 20px red",
|
||||
@ -169,16 +169,13 @@ const Graph = (): React.ReactNode => {
|
||||
|
||||
const onFlowSelectionChange: OnSelectionChangeFunc = useCallback(
|
||||
({ nodes, edges }) => {
|
||||
console.log(nodes);
|
||||
console.log(edges);
|
||||
|
||||
const nodeSelection = nodes[0]?.id ?? "";
|
||||
setSelectedNodeID(nodeSelection);
|
||||
setPlaylistNodes((nds) =>
|
||||
nds.map((nd) =>
|
||||
nd.id === nodeSelection
|
||||
? { ...nd, ...selectedNodeOptions }
|
||||
: { ...nd, ...nodeOptions }
|
||||
? { ...nd, ...selectedNodeProps }
|
||||
: { ...nd, ...nodeProps }
|
||||
)
|
||||
);
|
||||
const edgeSelection = edges[0]?.id ?? "";
|
||||
@ -275,7 +272,9 @@ const Graph = (): React.ReactNode => {
|
||||
setLoading(false);
|
||||
|
||||
if (resp?.status === 200) {
|
||||
showSuccessToastNotification(resp?.data.message);
|
||||
if (resp?.data.addedNum < resp?.data.toAddNum)
|
||||
showWarnToastNotification(resp?.data.message);
|
||||
else showSuccessToastNotification(resp?.data.message);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
@ -302,7 +301,9 @@ const Graph = (): React.ReactNode => {
|
||||
setLoading(false);
|
||||
|
||||
if (resp?.status === 200) {
|
||||
showSuccessToastNotification(resp?.data.message);
|
||||
if (resp?.data.deletedNum < resp?.data.toDelNum)
|
||||
showWarnToastNotification(resp?.data.message);
|
||||
else showSuccessToastNotification(resp?.data.message);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user