Skip to content

Commit

Permalink
resolve merge issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mayan-000 committed Mar 1, 2024
1 parent 005f57d commit 9bf6c6c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export type SidebarItemValue = {
children: SidebarItems;
popupTitle?: string;
infoIconDescription?: string;
extraInterfaceToTitle?: React.ReactNode;
extraInterfaceToTitle?: () => React.JSX.Element;
dropdownOpen?: boolean;
panel?: () => React.JSX.Element;
icon?: () => React.JSX.Element;
Expand Down
28 changes: 25 additions & 3 deletions packages/extension/src/view/devtools/components/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
*/
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
UNKNOWN_FRAME_KEY,
type CookieTableData,
ORPHANED_COOKIE_KEY,
UNMAPPED_COOKIE_KEY,
} from '@ps-analysis-tool/common';
import {
Sidebar,
Expand Down Expand Up @@ -103,15 +104,36 @@ const Layout = ({ setSidebarData }: LayoutProps) => {
);
psData.children['cookies'].children = Object.keys(tabFrames || {})
.filter((url) => {
return url === UNKNOWN_FRAME_KEY ? frameHasCookies[url] : true;
if (url === ORPHANED_COOKIE_KEY) {
return frameHasCookies[url];
}

if (url === UNMAPPED_COOKIE_KEY) {
return frameHasCookies[url];
}

return true;
})
.reduce<SidebarItems>((acc, url) => {
let popupTitle = `Cookies used by frames from ${url}`;
let infoIconDescription = '';
if (url === ORPHANED_COOKIE_KEY) {
popupTitle = infoIconDescription =
'Frames that set these cookies were removed from the DOM, leaving these cookies orphaned.';
}

if (url === UNMAPPED_COOKIE_KEY) {
popupTitle = infoIconDescription =
'Cookies that could not be mapped to any frame.';
}

acc[url] = {
title: url,
popupTitle: `Cookies used by frames from ${url}`,
popupTitle,
panel: () => <Cookies setFilteredCookies={setFilteredCookies} />,
icon: () => <CookieIcon />,
selectedIcon: () => <CookieIconWhite />,
infoIconDescription,
children: {},
isBlurred: !frameHasCookies?.[url],
};
Expand Down

0 comments on commit 9bf6c6c

Please sign in to comment.