1.0.1 • Published 4 months ago

aime-workflow-feedback2 v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Workflow Feedback NPM Package

This NPM package provides a WorkflowContainer component for managing feedback in your projects.

Installation

To install the package, run the following command:

# npm
npm install workflow-container-package

# or yarn
yarn add workflow-container-package

Usage

Import the WorkflowContainer component and use it in your React project. Here is an example of how to use the WorkflowContainer component in your project.

//App.tsx
import React from 'react';
import {WorkflowContainer} from 'workflow-container-package';

const App: React.FC = () => {
    // Define callback functions
    const handleSave = (data: any) => {
        console.log('Save action');
    };

    const handleCancel = () => {
        console.log('Cancel action');
    };

    const handleDelete = () => {
        console.log('Delete action');
    };

    const handleUpdate = (data: any) => {
        console.log('Update action');
    };

    return (
        <WorkflowContainer
            projectID={123}
            projectName={"Test Project"}
            onSave={handleSave}
            onCancel={handleCancel}
            onDelete={handleDelete}
            onUpdate={handleUpdate}
        />
    );
};

export default App;

Props

PropTypeDescription
projectIDnumberThe ID of the project.
projectNamestringThe name of the project.
onSavefunctionCallback function for the save action.
onCancelfunctionCallback function for the cancel action.
onDeletefunctionCallback function for the delete action.
onUpdatefunctionCallback function for the update action.
dataToPreview?anyExisting data that can be previewed

Updating content

In order to preview and update existing content, you can pass in the existing data to the dataToPreview prop. This will allow the user to preview the existing data and update it if needed. The WorkflowContainer component will automatically detect if the dataToPreview prop is passed in and will display the filled form fields and canvas content if any.

...

/* Existing data from db */
const data = fetch("endpoint")

return (
    <WorkflowContainer
        projectID={123}
        projectName={"Test Project"}
        onSave={handleSave}
        onCancel={handleCancel}
        onDelete={handleDelete}
        onUpdate={handleUpdate}
        dataToPreview={data}
    />
)