From 15a5a2ba5ddc7465e607b95e6c8af87b18c06343 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 17:50:05 +0000 Subject: [PATCH 1/6] Initial plan From 3a6b6dcaee2d108085cc8fa29115027275e02ccf Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 17:59:09 +0000 Subject: [PATCH 2/6] Remove favorites flag system from codebase Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com> --- src/extension/ExtensionStateManger.ts | 26 +---- src/extension/MainWebViewPanel.ts | 9 -- src/extension/SidebarWebViewPanel.ts | 76 ------------- src/extension/constants/collection.ts | 3 - src/extension/constants/command.ts | 2 - src/extension/utils/type.d.ts | 2 - webview/constants/options.ts | 2 +- webview/constants/sidebar.ts | 4 - webview/features/Sidebar/Menu/SidebarMenu.tsx | 10 +- .../Sidebar/Menu/SidebarMenuOption.tsx | 103 +++--------------- webview/store/slices/sidebarSlice.ts | 39 ------- webview/store/slices/type.d.ts | 10 -- 12 files changed, 23 insertions(+), 263 deletions(-) diff --git a/src/extension/ExtensionStateManger.ts b/src/extension/ExtensionStateManger.ts index 2ef3e1c..997712c 100644 --- a/src/extension/ExtensionStateManger.ts +++ b/src/extension/ExtensionStateManger.ts @@ -33,35 +33,13 @@ class ExtentionStateManager { } async updateExtensionContext(state: string, id: string, status?: string) { - const currentTime = new Date().getTime(); const globalHistoryState: IUserRequestSidebarState[] | undefined = this.context.globalState.get(state); - const globalFavoritesState: IUserRequestSidebarState[] | undefined = - this.context.globalState.get(COLLECTION.FAVORITES_COLLECTION); - if (!globalHistoryState || !globalFavoritesState) return; - - globalHistoryState.map( - (history) => - history.id === id && - ((history.isUserFavorite = !history.isUserFavorite), - (history.favoritedTime = currentTime)), - ); + if (!globalHistoryState) return; + // No favorites update needed anymore await this.context.globalState.update(state, [...globalHistoryState]); - - if (status) { - const duplicateFilteredUserFavoriteCollection = - filterDuplicatesFromObject( - globalHistoryState, - globalFavoritesState, - id, - ); - - await this.context.globalState.update(COLLECTION.FAVORITES_COLLECTION, [ - ...duplicateFilteredUserFavoriteCollection, - ]); - } } async deleteExtensionContext(targetExtensionContext: string, id?: string) { diff --git a/src/extension/MainWebViewPanel.ts b/src/extension/MainWebViewPanel.ts index e782ca3..1cfea80 100644 --- a/src/extension/MainWebViewPanel.ts +++ b/src/extension/MainWebViewPanel.ts @@ -155,8 +155,6 @@ class MainWebViewPanel { headers, responseType, requestedTime, - favoritedTime: null, - isUserFavorite: false, id: requestId, requestObject, }; @@ -177,7 +175,6 @@ class MainWebViewPanel { // Update sidebar this.sidebarWebViewPanel.postMainWebViewPanelMessage( this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION), - this.stateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION), ); } catch (error) { @@ -269,8 +266,6 @@ class MainWebViewPanel { { ...axiosConfiguration, requestedTime, - favoritedTime: null, - isUserFavorite: false, id: uuidv4(), requestObject, }, @@ -287,8 +282,6 @@ class MainWebViewPanel { { ...axiosConfiguration, requestedTime, - favoritedTime: null, - isUserFavorite: false, id: uuidv4(), requestObject, }, @@ -302,12 +295,10 @@ class MainWebViewPanel { if (this.mainPanel) { console.log( this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION), - this.stateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION), ); this.mainPanel.webview.postMessage(responseObject); this.sidebarWebViewPanel.postMainWebViewPanelMessage( this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION), - this.stateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION), ); } } diff --git a/src/extension/SidebarWebViewPanel.ts b/src/extension/SidebarWebViewPanel.ts index 6c1f869..fd63675 100644 --- a/src/extension/SidebarWebViewPanel.ts +++ b/src/extension/SidebarWebViewPanel.ts @@ -54,15 +54,11 @@ class SidebarWebViewPanel { history: this.stateManager.getExtensionContext( COLLECTION.HISTORY_COLLECTION, ), - favorites: this.stateManager.getExtensionContext( - COLLECTION.FAVORITES_COLLECTION, - ), collections: collections, }); console.log('Initial sidebar data sent:', { history: this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION), - favorites: this.stateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION), collections: collections }); @@ -73,9 +69,6 @@ class SidebarWebViewPanel { userHistoryData: { userRequestHistory: IUserRequestSidebarState[] | undefined; }, - userFavoritesData: { - userRequestHistory: IUserRequestSidebarState[] | undefined; - }, ) { if (!this.sidebarWebview) { console.log('Sidebar webview not available, skipping update'); @@ -87,14 +80,12 @@ class SidebarWebViewPanel { console.log('Updating sidebar with data:', { history: userHistoryData, - favorites: userFavoritesData, collections: collections }); this.sidebarWebview.webview.postMessage({ messageCategory: CATEGORY.COLLECTION_DATA, history: userHistoryData, - favorites: userFavoritesData, collections: collections, }); } @@ -114,74 +105,7 @@ class SidebarWebViewPanel { }) => { if (command === COMMAND.START_APP) { vscode.commands.executeCommand(COMMAND.MAIN_WEB_VIEW_PANEL); - } else if (command === COMMAND.ADD_TO_FAVORITES) { - // Get the request from history - const historyData = this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION); - const historyItem = historyData?.userRequestHistory?.find((item: any) => item.id === id); - - if (historyItem) { - // Mark as favorite in history - const updatedItem = { - ...historyItem, - isUserFavorite: true, - favoritedTime: new Date().getTime(), - }; - - // Add to favorites collection - const favoritesData = this.stateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION); - const favorites = favoritesData?.userRequestHistory || []; - - await this.stateManager.addExtensionContext(COLLECTION.FAVORITES_COLLECTION, { - history: [updatedItem, ...favorites], - }); - - // Update history to mark as favorite - const history = historyData?.userRequestHistory || []; - const updatedHistory = history.map((item: any) => - item.id === id ? updatedItem : item - ); - - await this.stateManager.addExtensionContext(COLLECTION.HISTORY_COLLECTION, { - history: updatedHistory, - }); - } - } else if (command === COMMAND.REMOVE_FROM_FAVORITES) { - // Get the request from history - const historyData = this.stateManager.getExtensionContext(COLLECTION.HISTORY_COLLECTION); - const historyItem = historyData?.userRequestHistory?.find((item: any) => item.id === id); - - if (historyItem) { - // Mark as not favorite in history - const updatedItem = { - ...historyItem, - isUserFavorite: false, - favoritedTime: null, - }; - - // Update history - const history = historyData?.userRequestHistory || []; - const updatedHistory = history.map((item: any) => - item.id === id ? updatedItem : item - ); - - await this.stateManager.addExtensionContext(COLLECTION.HISTORY_COLLECTION, { - history: updatedHistory, - }); - } - - // Remove from favorites collection - await this.stateManager.deleteExtensionContext( - COLLECTION.FAVORITES_COLLECTION, - id, - ); } else if (command === COMMAND.DELETE) { - if (target === COLLECTION.FAVORITES_COLLECTION) { - await this.stateManager.updateExtensionContext( - COLLECTION.HISTORY_COLLECTION, - id, - ); - } - await this.stateManager.deleteExtensionContext(target, id); } else if (command === COMMAND.DELETE_ALL_COLLECTION) { const answer = await vscode.window.showWarningMessage( diff --git a/src/extension/constants/collection.ts b/src/extension/constants/collection.ts index a3fd569..5143680 100644 --- a/src/extension/constants/collection.ts +++ b/src/extension/constants/collection.ts @@ -1,12 +1,9 @@ const COLLECTION = { - FAVORITES_COLLECTION: "userFavorites", HISTORY_COLLECTION: "userRequestHistory", COLLECTION_REQUEST: "Collection Request", FILTERABLE_OBJECT_KEY: [ - "favoritedTime", "id", "requestedTime", - "isUserFavorite", ], }; diff --git a/src/extension/constants/command.ts b/src/extension/constants/command.ts index 07a6114..e716f15 100644 --- a/src/extension/constants/command.ts +++ b/src/extension/constants/command.ts @@ -3,10 +3,8 @@ const COMMAND = { DELETE: "Delete", START_APP: "Start App", ALERT_COPY: "Alert Copy", - ADD_TO_FAVORITES: "Add to favorites", MAIN_WEB_VIEW_PANEL: "opencall.newRequest", SIDEBAR_WEB_VIEW_PANEL: "opencall.collectionMenu", - REMOVE_FROM_FAVORITES: "Remove from favorites", DELETE_ALL_COLLECTION: "Delete all collection", }; diff --git a/src/extension/utils/type.d.ts b/src/extension/utils/type.d.ts index 445cf40..2a824f0 100644 --- a/src/extension/utils/type.d.ts +++ b/src/extension/utils/type.d.ts @@ -4,8 +4,6 @@ export interface IUserRequestSidebarState { headers: Headers; responseType: string; requestedTime: number; - favoritedTime: number | null; - isUserFavorite: boolean; id: string; requestObject: RequestObject; } diff --git a/webview/constants/options.ts b/webview/constants/options.ts index b5a4882..0403c82 100644 --- a/webview/constants/options.ts +++ b/webview/constants/options.ts @@ -57,7 +57,7 @@ const OPTION = { READ_ONLY_TRUE_OPTION: { readOnly: true, lineNumbers: "on" }, READ_ONLY_FALSE_OPTION: { readOnly: false, lineNumbers: "on" }, LINE_NUMBER_OPTION: { readOnly: true, lineNumbers: "off" }, - SIDEBAR_MENU_OPTIONS: ["Collections", "History", "Favorites"], + SIDEBAR_MENU_OPTIONS: ["Collections", "History"], CODE_SNIPPET_OPTIONS: [ { key: "c", diff --git a/webview/constants/sidebar.ts b/webview/constants/sidebar.ts index c1eab88..b4d5afe 100644 --- a/webview/constants/sidebar.ts +++ b/webview/constants/sidebar.ts @@ -2,14 +2,10 @@ const SIDEBAR = { DELETE: "Delete", HISTORY: "History", START_APP: "Start App", - FAVORITES: "Favorites", COLLECTIONS: "Collections", COLLECTION_DATA: "Collection Data", - ADD_TO_FAVORITES: "Add to favorites", DELETE_COMPLETE: "Deletion Complete", - USER_FAVORITES_COLLECTION: "userFavorites", DELETE_ALL_COLLECTION: "Delete all collection", - REMOVE_FROM_FAVORITES: "Remove from favorites", USER_REQUEST_HISTORY_COLLECTION: "userRequestHistory", }; diff --git a/webview/features/Sidebar/Menu/SidebarMenu.tsx b/webview/features/Sidebar/Menu/SidebarMenu.tsx index 11420f8..3b40f96 100644 --- a/webview/features/Sidebar/Menu/SidebarMenu.tsx +++ b/webview/features/Sidebar/Menu/SidebarMenu.tsx @@ -15,18 +15,14 @@ const SidebarMenu = () => { sidebarOption, deleteCollection, handleSidebarOption, - resetFavoriteIconState, handleUserHistoryCollection, - handleUserFavoritesCollection, handleUserCollections, } = useStore( (state) => ({ sidebarOption: state.sidebarOption, deleteCollection: state.deleteCollection, handleSidebarOption: state.handleSidebarOption, - resetFavoriteIconState: state.resetFavoriteIconState, handleUserHistoryCollection: state.handleUserHistoryCollection, - handleUserFavoritesCollection: state.handleUserFavoritesCollection, handleUserCollections: state.handleUserCollections, }), shallow, @@ -43,16 +39,14 @@ const SidebarMenu = () => { useLayoutEffect(() => { window.addEventListener("message", (message) => { console.log('Sidebar received message:', message.data); - const { messageCategory, history, favorites, collections, target } = message.data; + const { messageCategory, history, collections, target } = message.data; if (messageCategory === SIDEBAR.COLLECTION_DATA) { - console.log('Processing collection data:', { history, favorites, collections }); + console.log('Processing collection data:', { history, collections }); handleUserHistoryCollection(history?.userRequestHistory); - handleUserFavoritesCollection(favorites?.userRequestHistory); handleUserCollections(collections || []); } else if (messageCategory === SIDEBAR.DELETE_COMPLETE) { deleteCollection(target); - resetFavoriteIconState(); } }); }, []); diff --git a/webview/features/Sidebar/Menu/SidebarMenuOption.tsx b/webview/features/Sidebar/Menu/SidebarMenuOption.tsx index 0cffa1e..52c2e91 100644 --- a/webview/features/Sidebar/Menu/SidebarMenuOption.tsx +++ b/webview/features/Sidebar/Menu/SidebarMenuOption.tsx @@ -9,106 +9,46 @@ import { ISidebarSliceList } from "../../../store/slices/type"; const SidebarMenuOption = () => { const { - userFavorites, sidebarOption, userRequestHistory, userCollections, handleUserDeleteIcon, - handleUserFavoriteIcon, - addCollectionToFavorites, - removeFromFavoriteCollection, } = useStore( (state) => ({ sidebarOption: state.sidebarOption, - userFavorites: state.userFavorites, userRequestHistory: state.userRequestHistory, userCollections: state.userCollections, handleUserDeleteIcon: state.handleUserDeleteIcon, - handleUserFavoriteIcon: state.handleUserFavoriteIcon, - addCollectionToFavorites: state.addCollectionToFavorites, - removeFromFavoriteCollection: state.removeFromFavoriteCollection, }), shallow, ); const sidebarCollectionProps = { sidebarOption, - handleSidebarFavoriteIcon(command: string, id: string) { - const currentTime = new Date().getTime(); - - if (command === SIDEBAR.ADD_TO_FAVORITES) { - vscode.postMessage({ command, id }); - - const selectedCollection = userRequestHistory.filter( - (collection) => collection.id === id, - ); - selectedCollection[0].favoritedTime = currentTime; - - handleUserFavoriteIcon(id, currentTime); - addCollectionToFavorites(selectedCollection); - } else if (command === SIDEBAR.REMOVE_FROM_FAVORITES) { - vscode.postMessage({ command, id }); - - handleUserFavoriteIcon(id, null); - removeFromFavoriteCollection(id); - } - }, handleDeleteButton(id: string) { - switch (sidebarOption) { - case SIDEBAR.FAVORITES: - handleUserDeleteIcon( - SIDEBAR.USER_FAVORITES_COLLECTION as keyof ISidebarSliceList, - id, - ); - handleUserFavoriteIcon(id, null); - - return vscode.postMessage({ - command: SIDEBAR.DELETE, - id, - target: SIDEBAR.USER_FAVORITES_COLLECTION, - }); - default: - handleUserDeleteIcon( - SIDEBAR.USER_REQUEST_HISTORY_COLLECTION as keyof ISidebarSliceList, - id, - ); + handleUserDeleteIcon( + SIDEBAR.USER_REQUEST_HISTORY_COLLECTION as keyof ISidebarSliceList, + id, + ); - return vscode.postMessage({ - command: SIDEBAR.DELETE, - id, - target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, - }); - } + return vscode.postMessage({ + command: SIDEBAR.DELETE, + id, + target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, + }); }, handleDeleteAllButton() { - switch (sidebarOption) { - case SIDEBAR.FAVORITES: - return vscode.postMessage({ - command: SIDEBAR.DELETE_ALL_COLLECTION, - target: SIDEBAR.USER_FAVORITES_COLLECTION, - }); - default: - return vscode.postMessage({ - command: SIDEBAR.DELETE_ALL_COLLECTION, - target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, - }); - } + return vscode.postMessage({ + command: SIDEBAR.DELETE_ALL_COLLECTION, + target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, + }); }, handleUrlClick(id: string) { - switch (sidebarOption) { - case SIDEBAR.FAVORITES: - return vscode.postMessage({ - command: REQUEST.URL_REQUEST, - id, - target: SIDEBAR.USER_FAVORITES_COLLECTION, - }); - default: - return vscode.postMessage({ - command: REQUEST.URL_REQUEST, - id, - target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, - }); - } + return vscode.postMessage({ + command: REQUEST.URL_REQUEST, + id, + target: SIDEBAR.USER_REQUEST_HISTORY_COLLECTION, + }); }, }; @@ -120,13 +60,6 @@ const SidebarMenuOption = () => { {...sidebarCollectionProps} /> ); - case SIDEBAR.FAVORITES: - return ( - - ); default: return ( = ( set, ) => ({ - userFavorites: [], userRequestHistory: [], userCollections: [], sidebarOption: SIDEBAR.HISTORY, @@ -20,25 +19,9 @@ const sidebarSlice: StateCreator = ( handleUserHistoryCollection: (historyData: IUserRequestSidebarState[]) => set(() => ({ userRequestHistory: historyData })), - handleUserFavoritesCollection: (favoritesData: IUserRequestSidebarState[]) => - set(() => ({ userFavorites: favoritesData })), - handleUserCollections: (collectionsData: any[]) => set(() => ({ userCollections: collectionsData })), - handleUserFavoriteIcon: (id: string, time: number | null) => - set((state) => ({ - userRequestHistory: state.userRequestHistory.map((historyData) => - historyData.id === id - ? { - ...historyData, - isUserFavorite: !historyData.isUserFavorite, - favoritedTime: time, - } - : historyData, - ), - })), - handleUserDeleteIcon: (targetState: keyof ISidebarSliceList, id: string) => { set((state) => ({ [targetState]: state[targetState].filter( @@ -47,28 +30,6 @@ const sidebarSlice: StateCreator = ( })); }, - addCollectionToFavorites: (collection: IUserRequestSidebarState[]) => - set((state) => ({ - userFavorites: [...collection, ...state.userFavorites], - })), - - removeFromFavoriteCollection: (id: string) => { - set((state) => ({ - userFavorites: state.userFavorites.filter( - (historyData) => historyData.id !== id, - ), - })); - }, - - resetFavoriteIconState: () => - set((state) => ({ - userRequestHistory: state.userRequestHistory.map((historyData) => - historyData.isUserFavorite === true - ? { ...historyData, isUserFavorite: false } - : historyData, - ), - })), - deleteCollection: (targetState: string) => { set(() => ({ [targetState]: [] })); }, diff --git a/webview/store/slices/type.d.ts b/webview/store/slices/type.d.ts index 1a27f6f..2aa0847 100644 --- a/webview/store/slices/type.d.ts +++ b/webview/store/slices/type.d.ts @@ -4,23 +4,15 @@ export interface ISidebarSlice extends ISidebarSliceList { handleUserHistoryCollection: ( historyData: IUserRequestSidebarState[], ) => void; - handleUserFavoritesCollection: ( - favoritesData: IUserRequestSidebarState[], - ) => void; handleUserCollections: (collectionsData: any[]) => void; - handleUserFavoriteIcon: (id: string, time: number | null) => void; handleUserDeleteIcon: ( targetState: keyof ISidebarSliceList, id: string, ) => void; - addCollectionToFavorites: (collection: IUserRequestSidebarState[]) => void; - removeFromFavoriteCollection: (id: string) => void; - resetFavoriteIconState: () => void; deleteCollection: (targetState: string) => void; } export interface ISidebarSliceList { - userFavorites: IUserRequestSidebarState[]; userRequestHistory: IUserRequestSidebarState[]; userCollections: any[]; } @@ -31,8 +23,6 @@ export interface IUserRequestSidebarState { headers: Headers; responseType: string; requestedTime: number; - favoritedTime: number | null; - isUserFavorite: boolean; id: string; requestObject: RequestObject; } From bcde912f3bdc3f2e20e25e53bb4792db204b410d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:01:41 +0000 Subject: [PATCH 3/6] Fix compilation errors and build successfully Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com> --- src/extension/ExtensionStateManger.ts | 1 - src/extension/extension.ts | 6 ------ src/extension/utils/filterDuplicatesFromObject.ts | 7 +++---- src/utils/filterDuplicatesFromObject.ts | 7 +++---- src/utils/type.d.ts | 2 -- 5 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/extension/ExtensionStateManger.ts b/src/extension/ExtensionStateManger.ts index 997712c..d8907a6 100644 --- a/src/extension/ExtensionStateManger.ts +++ b/src/extension/ExtensionStateManger.ts @@ -1,7 +1,6 @@ import * as vscode from "vscode"; import { COLLECTION } from "./constants"; -import { filterDuplicatesFromObject } from "./utils"; import { IUserRequestSidebarState } from "./utils/type"; class ExtentionStateManager { diff --git a/src/extension/extension.ts b/src/extension/extension.ts index 7f67349..5b9b003 100644 --- a/src/extension/extension.ts +++ b/src/extension/extension.ts @@ -130,12 +130,6 @@ export async function activate(context: vscode.ExtensionContext) { }); } - if (!StateManager.getExtensionContext(COLLECTION.FAVORITES_COLLECTION)) { - await StateManager.addExtensionContext(COLLECTION.FAVORITES_COLLECTION, { - history: [], - }); - } - vscode.window.showInformationMessage(MESSAGE.WELCOME_MESSAGE); // Collections are now shown in the webview sidebar tabs diff --git a/src/extension/utils/filterDuplicatesFromObject.ts b/src/extension/utils/filterDuplicatesFromObject.ts index b25cc9a..4bad44f 100644 --- a/src/extension/utils/filterDuplicatesFromObject.ts +++ b/src/extension/utils/filterDuplicatesFromObject.ts @@ -1,20 +1,19 @@ import { IUserRequestSidebarState } from "./type"; +// This function was used for favorites functionality which has been removed. +// Keeping as placeholder for potential future use. const filterDuplicatesFromObject = ( currentCollection: IUserRequestSidebarState[], previousCollection: IUserRequestSidebarState[], id: string, ) => { const arr: string[] = []; - const filteredCurrentCollection = currentCollection.filter( - (history) => history.isUserFavorite, - ); const filteredPreviousCollection = previousCollection?.filter((history) => history.id !== id) || []; const combinedCollection = [ - ...filteredCurrentCollection, + ...currentCollection, ...filteredPreviousCollection, ]; diff --git a/src/utils/filterDuplicatesFromObject.ts b/src/utils/filterDuplicatesFromObject.ts index b25cc9a..4bad44f 100644 --- a/src/utils/filterDuplicatesFromObject.ts +++ b/src/utils/filterDuplicatesFromObject.ts @@ -1,20 +1,19 @@ import { IUserRequestSidebarState } from "./type"; +// This function was used for favorites functionality which has been removed. +// Keeping as placeholder for potential future use. const filterDuplicatesFromObject = ( currentCollection: IUserRequestSidebarState[], previousCollection: IUserRequestSidebarState[], id: string, ) => { const arr: string[] = []; - const filteredCurrentCollection = currentCollection.filter( - (history) => history.isUserFavorite, - ); const filteredPreviousCollection = previousCollection?.filter((history) => history.id !== id) || []; const combinedCollection = [ - ...filteredCurrentCollection, + ...currentCollection, ...filteredPreviousCollection, ]; diff --git a/src/utils/type.d.ts b/src/utils/type.d.ts index 445cf40..2a824f0 100644 --- a/src/utils/type.d.ts +++ b/src/utils/type.d.ts @@ -4,8 +4,6 @@ export interface IUserRequestSidebarState { headers: Headers; responseType: string; requestedTime: number; - favoritedTime: number | null; - isUserFavorite: boolean; id: string; requestObject: RequestObject; } From 54b9e8ef3f0af6da61afb76692d2854d5a435e96 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:03:46 +0000 Subject: [PATCH 4/6] Clean up favorites references in UI components Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com> --- webview/components/MoreInformation.tsx | 4 -- .../Sidebar/Collection/SidebarCollection.tsx | 39 +------------------ .../Menu/SidebarEmptyCollectionMenu.tsx | 5 +-- 3 files changed, 2 insertions(+), 46 deletions(-) diff --git a/webview/components/MoreInformation.tsx b/webview/components/MoreInformation.tsx index 05cc7df..c033bb7 100644 --- a/webview/components/MoreInformation.tsx +++ b/webview/components/MoreInformation.tsx @@ -30,10 +30,6 @@ const MoreInformationWrapper = styled.div` opacity: 0.45; } } - - .favorite { - fill: var(--vscode-errorForeground, #f48771); - } `; export default MoreInformation; diff --git a/webview/features/Sidebar/Collection/SidebarCollection.tsx b/webview/features/Sidebar/Collection/SidebarCollection.tsx index e03eff0..c4a3e9a 100644 --- a/webview/features/Sidebar/Collection/SidebarCollection.tsx +++ b/webview/features/Sidebar/Collection/SidebarCollection.tsx @@ -1,5 +1,4 @@ import React, { useState } from "react"; -import { AiFillHeart, AiOutlineHeart } from "react-icons/ai"; import { FaTrashAlt } from "react-icons/fa"; import styled from "styled-components"; @@ -20,15 +19,12 @@ interface ISidebarCollectionProps { headers: Headers; responseType: string; requestedTime: number; - favoritedTime: number | null; - isUserFavorite: boolean; id: string; requestObject: RequestObject; }[]; handleUrlClick: (id: string) => void; handleDeleteButton: (id: string) => void; handleDeleteAllButton: () => void; - handleSidebarFavoriteIcon: (stringValue: string, id: string) => void; } const SidebarCollection = ({ sidebarOption, @@ -36,7 +32,6 @@ const SidebarCollection = ({ handleUrlClick, handleDeleteButton, handleDeleteAllButton, - handleSidebarFavoriteIcon, }: ISidebarCollectionProps) => { const [searchInputValue, setSearchInputValue] = useState(""); @@ -68,19 +63,14 @@ const SidebarCollection = ({ ({ url, method, - isUserFavorite, id, requestedTime, - favoritedTime, }) => { const methodColor = generateMethodColor( method.toLowerCase(), ); const collectionCreatedTime = calculateCollectionTime(requestedTime); - const favoriteListedTime = calculateCollectionTime( - favoritedTime || 0, - ); return ( @@ -94,36 +84,9 @@ const SidebarCollection = ({
- {sidebarOption === SIDEBAR.HISTORY ? ( -

{collectionCreatedTime}

- ) : ( -

Added {favoriteListedTime}

- )} +

{collectionCreatedTime}

- {sidebarOption === SIDEBAR.HISTORY ? ( - isUserFavorite ? ( - - handleSidebarFavoriteIcon( - SIDEBAR.REMOVE_FROM_FAVORITES, - id, - ) - } - /> - ) : ( - - handleSidebarFavoriteIcon( - SIDEBAR.ADD_TO_FAVORITES, - id, - ) - } - /> - ) - ) : null} handleDeleteButton(id)} diff --git a/webview/features/Sidebar/Menu/SidebarEmptyCollectionMenu.tsx b/webview/features/Sidebar/Menu/SidebarEmptyCollectionMenu.tsx index e365d44..317ad12 100644 --- a/webview/features/Sidebar/Menu/SidebarEmptyCollectionMenu.tsx +++ b/webview/features/Sidebar/Menu/SidebarEmptyCollectionMenu.tsx @@ -2,7 +2,6 @@ import React from "react"; import Message from "../../../components/Message"; import { SIDEBAR } from "../../../constants"; -import EmptyFavoritesCollectionMessage from "../Message/EmptyFavoritesCollectionMessage"; import EmptyHistoryCollectionMessage from "../Message/EmptyHistoryCollectionMessage"; interface ISibebarEmptyCollectionMenuProps { @@ -16,10 +15,8 @@ const SibebarEmptyCollectionMenu = ({ {currentSidebarOption === SIDEBAR.HISTORY ? ( - ) : currentSidebarOption === SIDEBAR.COLLECTIONS ? ( -

No collections yet. Create a collection to organize your requests.

) : ( - +

No collections yet. Create a collection to organize your requests.

)}
); From 65566919c554e87178b30bcf2db31e6f7a0a2d66 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 15 Jan 2026 18:07:15 +0000 Subject: [PATCH 5/6] Remove unused filterDuplicatesFromObject utility functions Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com> --- .../utils/filterDuplicatesFromObject.ts | 30 ------------------- src/extension/utils/index.ts | 1 - src/utils/filterDuplicatesFromObject.ts | 30 ------------------- src/utils/index.ts | 1 - 4 files changed, 62 deletions(-) delete mode 100644 src/extension/utils/filterDuplicatesFromObject.ts delete mode 100644 src/utils/filterDuplicatesFromObject.ts diff --git a/src/extension/utils/filterDuplicatesFromObject.ts b/src/extension/utils/filterDuplicatesFromObject.ts deleted file mode 100644 index 4bad44f..0000000 --- a/src/extension/utils/filterDuplicatesFromObject.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { IUserRequestSidebarState } from "./type"; - -// This function was used for favorites functionality which has been removed. -// Keeping as placeholder for potential future use. -const filterDuplicatesFromObject = ( - currentCollection: IUserRequestSidebarState[], - previousCollection: IUserRequestSidebarState[], - id: string, -) => { - const arr: string[] = []; - - const filteredPreviousCollection = - previousCollection?.filter((history) => history.id !== id) || []; - - const combinedCollection = [ - ...currentCollection, - ...filteredPreviousCollection, - ]; - - const duplicateFilteredCollection = combinedCollection.filter((history) => { - if (!arr.includes(history.id)) { - arr.push(history.id); - return history; - } - }); - - return duplicateFilteredCollection; -}; - -export default filterDuplicatesFromObject; diff --git a/src/extension/utils/index.ts b/src/extension/utils/index.ts index 359e47e..fe34b9e 100644 --- a/src/extension/utils/index.ts +++ b/src/extension/utils/index.ts @@ -1,4 +1,3 @@ -export { default as filterDuplicatesFromObject } from "./filterDuplicatesFromObject"; export { default as filterObjectKey } from "./filterObjectKey"; export { default as generateArrayObjectFromData } from "./generateArrayObjectFromData"; export { default as generateResponseObject } from "./generateResponseObject"; diff --git a/src/utils/filterDuplicatesFromObject.ts b/src/utils/filterDuplicatesFromObject.ts deleted file mode 100644 index 4bad44f..0000000 --- a/src/utils/filterDuplicatesFromObject.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { IUserRequestSidebarState } from "./type"; - -// This function was used for favorites functionality which has been removed. -// Keeping as placeholder for potential future use. -const filterDuplicatesFromObject = ( - currentCollection: IUserRequestSidebarState[], - previousCollection: IUserRequestSidebarState[], - id: string, -) => { - const arr: string[] = []; - - const filteredPreviousCollection = - previousCollection?.filter((history) => history.id !== id) || []; - - const combinedCollection = [ - ...currentCollection, - ...filteredPreviousCollection, - ]; - - const duplicateFilteredCollection = combinedCollection.filter((history) => { - if (!arr.includes(history.id)) { - arr.push(history.id); - return history; - } - }); - - return duplicateFilteredCollection; -}; - -export default filterDuplicatesFromObject; diff --git a/src/utils/index.ts b/src/utils/index.ts index 359e47e..fe34b9e 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1,4 +1,3 @@ -export { default as filterDuplicatesFromObject } from "./filterDuplicatesFromObject"; export { default as filterObjectKey } from "./filterObjectKey"; export { default as generateArrayObjectFromData } from "./generateArrayObjectFromData"; export { default as generateResponseObject } from "./generateResponseObject"; From 13b11815f220dc4ec7cb9903bdc54ed2f35e7213 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 09:22:07 +0000 Subject: [PATCH 6/6] Remove unused updateExtensionContext method Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com> --- src/extension/ExtensionStateManger.ts | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/extension/ExtensionStateManger.ts b/src/extension/ExtensionStateManger.ts index d8907a6..c66a30c 100644 --- a/src/extension/ExtensionStateManger.ts +++ b/src/extension/ExtensionStateManger.ts @@ -31,16 +31,6 @@ class ExtentionStateManager { await this.context.globalState.update(state, history); } - async updateExtensionContext(state: string, id: string, status?: string) { - const globalHistoryState: IUserRequestSidebarState[] | undefined = - this.context.globalState.get(state); - - if (!globalHistoryState) return; - - // No favorites update needed anymore - await this.context.globalState.update(state, [...globalHistoryState]); - } - async deleteExtensionContext(targetExtensionContext: string, id?: string) { const targetGlobalState: IUserRequestSidebarState[] | undefined = this.context.globalState.get(targetExtensionContext);