From e40eebb521da5bd60c75eb725572a4efab702e4d Mon Sep 17 00:00:00 2001 From: Kuba Orlik Date: Sun, 7 Nov 2021 19:28:07 +0100 Subject: [PATCH] More fixes around filter --- sidebar/sidebar.tsx | 4 ++++ sidebar/stolen-data-cluster.tsx | 4 +++- sidebar/stolen-data.tsx | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sidebar/sidebar.tsx b/sidebar/sidebar.tsx index 04f66d8..6f94a08 100644 --- a/sidebar/sidebar.tsx +++ b/sidebar/sidebar.tsx @@ -17,6 +17,7 @@ const Sidebar = () => { const [origin, setOrigin] = useState(null); const [minValueLength, setMinValueLength] = useState(7); const [cookiesOnly, setCookiesOnly] = useState(false); + const [cookiesOrOriginOnly, setCookiesOrOriginOnly] = useState(true); const [counter, setCounter] = useEmitter(getMemory()); useEffect(() => { @@ -51,6 +52,8 @@ const Sidebar = () => { setMinValueLength={setMinValueLength} cookiesOnly={cookiesOnly} setCookiesOnly={setCookiesOnly} + cookiesOrOriginOnly={cookiesOrOriginOnly} + setCookiesOrOriginOnly={setCookiesOrOriginOnly} /> { refresh={() => setCounter((c) => c + 1)} minValueLength={minValueLength} cookiesOnly={cookiesOnly} + cookiesOrOriginOnly={cookiesOrOriginOnly} /> ); diff --git a/sidebar/stolen-data-cluster.tsx b/sidebar/stolen-data-cluster.tsx index 92dc7ee..26f29b7 100644 --- a/sidebar/stolen-data-cluster.tsx +++ b/sidebar/stolen-data-cluster.tsx @@ -75,12 +75,14 @@ export default function StolenDataCluster({ shorthost, minValueLength, cookiesOnly, + cookiesOrOriginOnly, }: { origin: string; shorthost: string; refreshToken: number; minValueLength: number; cookiesOnly: boolean; + cookiesOrOriginOnly: boolean; }) { const cluster = getMemory().getClustersForOrigin(origin)[shorthost]; const icons: Record = { @@ -110,7 +112,7 @@ export default function StolenDataCluster({ {cluster - .getStolenData({ minValueLength, cookiesOnly }) + .getStolenData({ minValueLength, cookiesOnly, cookiesOrOriginOnly }) .map((entry) => ( void; minValueLength: number; cookiesOnly: boolean; + cookiesOrOriginOnly: boolean; }) { if (!origin) { return
; @@ -64,6 +66,12 @@ export function StolenData({ {clusters .filter((cluster) => !cookiesOnly || cluster.hasCookies()) + .filter( + (cluster) => + !cookiesOrOriginOnly || + cluster.hasCookies() || + cluster.exposesOrigin() + ) .map((cluster) => { return ( ); })}