Skip to content

Instantly share code, notes, and snippets.

View MariusBongarts's full-sized avatar

Marius Bongarts MariusBongarts

View GitHub Profile
{
"action": {
"default_title": "Chrome History Dashboard",
"default_popup": "./index.html",
"default_icon": {
"16": "images/icon16.png", // optional
"24": "images/icon24.png", // optional
"32": "images/icon32.png" // optional
},
}
export const History: React.FC<HistoryProps> = ({ items }) => {
return (
<StyledList>
{items.map((item) => (
<HistoryItem key={item.id} item={item} />
))}
</StyledList>
);
};
const StyledList = styled.ul`
list-style: none;
padding: 0;
margin: 0;
`;
import React from "react";
import { useChromeHistorySearch } from "../hooks/useChromeHistorySearch";
import { History } from "./History";
interface DashboardProps {}
const query = { text: "", maxResults: 100 };
export const Dashboard: React.FC<DashboardProps> = () => {
const mostRecentItems = useChromeHistorySearch(query);
import React from "react";
interface HistoryItemProps {
item: chrome.history.HistoryItem;
}
export const HistoryItem: React.FC<HistoryItemProps> = ({ item }) => {
return (
<li>
<span>{new Date(item.lastVisitTime ?? 0).toLocaleTimeString()}</span>
import React from "react";
import { HistoryItem } from "./HistoryItem";
import { StyledList } from "./History.styled";
const MemoizedHistoryItem = React.memo(HistoryItem);
interface HistoryProps {
items: chrome.history.HistoryItem[];
}
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
const rootElement = document.createElement("div");
rootElement.id = "chrome-history-dashboard";
document.body.appendChild(rootElement);
const root = ReactDOM.createRoot(rootElement);
root.render(
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chrome History Dashboard</title>
<style>
body {
{
"name": "chrome-history-extension",
"description": "Chrome extension that accesses the chrome history API to read the browser history and display it in our own personalized React dashboard",
"version": "1.0.0",
"manifest_version": 3,
"action": {
"default_title": "Chrome History Dashboard",
"default_popup": "./index.html"
}
}
{
"name": "Chrome History Extension",
"version": "1.0.0",
"manifest_version": 3
}