This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
... | |
"types": ["chrome", "@types/chrome"] | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require("path"); | |
const config = require("./webpack.config"); | |
module.exports = { | |
...config, | |
mode: "development", | |
devServer: { | |
static: { | |
directory: path.join(__dirname, "extension"), | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "chrome-history-extension", | |
... | |
"permissions": ["history"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "chrome-history-extension", | |
... | |
"scripts": { | |
"start": "webpack serve --config webpack.dev.js", | |
"build": "webpack", | |
}, | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "chrome-history-extension", | |
... | |
"scripts": { | |
"start": "react-scripts start", | |
"build": "react-scripts build", | |
}, | |
... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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 | |
}, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const History: React.FC<HistoryProps> = ({ items }) => { | |
return ( | |
<StyledList> | |
{items.map((item) => ( | |
<HistoryItem key={item.id} item={item} /> | |
))} | |
</StyledList> | |
); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const StyledList = styled.ul` | |
list-style: none; | |
padding: 0; | |
margin: 0; | |
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |