import React from 'react'; import ReactDOM from 'react-dom'; import Options from '../../options'; import { StolenData } from './stolen-data'; import { getshorthost, useEmitter } from '../../util'; import { getMemory } from '../../memory'; async function getCurrentTab() { const [tab] = await browser.tabs.query({ active: true, windowId: browser.windows.WINDOW_ID_CURRENT, }); return tab; } import './../../styles/global.scss'; import './sidebar.scss'; const Sidebar = () => { const url = new URL(document.location.toString()); const origin = url.searchParams.get('origin'); const [minValueLength, setMinValueLength] = React.useState( localStorage.getItem('minValueLength') === null ? 7 : (localStorage.getItem('minValueLength') as unknown as number) ); const [cookiesOnly, setCookiesOnly] = React.useState(false); const [stolenDataView, setStolenDataView] = React.useState(true); const [cookiesOrOriginOnly, setCookiesOrOriginOnly] = React.useState(false); const [eventCounts, setEventCounts] = useEmitter(getMemory()); const [marksOccurrence, setMarksOccurrence] = React.useState(false); const [infoDataDialogAck, setInfoDataDialogAck] = React.useState( localStorage.getItem('infoDataDialogAck') === null ? true : localStorage.getItem('infoDataDialogAck') == 'true' ? true : false ); const [warningDataDialogAck, setWarningDataDialogAck] = React.useState( localStorage.getItem('warningDataDialogAck') === null ? true : localStorage.getItem('warningDataDialogAck') == 'true' ? true : false ); const [detailsVisibility, setDetailsVisibility] = React.useState( localStorage.getItem('detailsVisibility') === null ? false : localStorage.getItem('detailsVisibility') == 'true' ? true : false ); React.useEffect(() => { for (const cluster of Object.values(getMemory().getClustersForOrigin(origin))) { if (cluster.hasMarks()) { return setMarksOccurrence(true); } } return setMarksOccurrence(false); }, [eventCounts['*']]); return (
{origin ? ( <> Analiza strony {origin} ) : ( Przejdź do wybranej strony internetowej )}
{stolenDataView ? ( ) : null}
{stolenDataView ? ( <> {infoDataDialogAck ? (
Rentgen automatycznie zaznacza wybrane domeny na podstawie zebranych danych. {' '} Możesz teraz przejść do generowania raportu lub dokonać korekty.
) : null} {warningDataDialogAck ? (
Uwaga! Niekoniecznie każda przesłana poniżej informacja jest daną osobową. Niektóre z podanych domen mogą należeć do właściciela strony i nie reprezentować podmiotów trzecich.
) : null} ) : ( { getMemory().removeCookiesFor(origin); getMemory().emit('change', origin); setMarksOccurrence(false); }} removeRequests={() => { getMemory().removeRequestsFor(origin); getMemory().emit('change', origin); setMarksOccurrence(false); }} /> )}
); }; ReactDOM.render(, document.getElementById('app'));