## Description Separate the Sidebar Component from the various IDEs and move it to the IDE module. Fixes #34554 ## Automation /ok-to-test tags="@tag.IDE" ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9869212078> > Commit: 0b685d46ba18bb98e37fde87a96c930172fc5c15 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9869212078&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.IDE` > Spec: > <hr>Wed, 10 Jul 2024 06:47:16 UTC <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new sidebar component (`IDESidebar`) managing button states and handling interactions. - Added `Condition` enum for better condition management with icons and colors in the sidebar buttons. - **Enhancements** - Improved click handling for sidebar buttons with a new `handleOnClick` function. - **Tests** - Added test cases for `SidebarButton` component to validate different conditions and click behaviors. - **Components** - New React components and interfaces for managing the IDE's sidebar functionality and state. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
34 lines
993 B
TypeScript
34 lines
993 B
TypeScript
import { APP_MODE } from "entities/App";
|
|
import type { JSLibrary } from "workers/common/JSLibrary";
|
|
import Api from "./Api";
|
|
|
|
export default class LibraryApi extends Api {
|
|
static base_url = "v1/libraries";
|
|
|
|
static getUpdateLibraryBaseURL = (applicationId: string) =>
|
|
`${LibraryApi.base_url}/${applicationId}`;
|
|
|
|
static async addLibrary(
|
|
applicationId: string,
|
|
library: Partial<JSLibrary> & { defs: string },
|
|
) {
|
|
const url = LibraryApi.getUpdateLibraryBaseURL(applicationId) + "/add";
|
|
return Api.patch(url, library);
|
|
}
|
|
|
|
static async removeLibrary(
|
|
applicationId: string,
|
|
library: Partial<JSLibrary>,
|
|
) {
|
|
const url = LibraryApi.getUpdateLibraryBaseURL(applicationId) + "/remove";
|
|
return Api.patch(url, library);
|
|
}
|
|
|
|
static async getLibraries(applicationId: string, mode: APP_MODE) {
|
|
const url = `${LibraryApi.getUpdateLibraryBaseURL(applicationId)}${
|
|
mode === APP_MODE.PUBLISHED ? "/view" : ""
|
|
}`;
|
|
return Api.get(url);
|
|
}
|
|
}
|