Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/extension/entrypoints/options/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ body { background: var(--ground); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.strong { font-weight: 500; }
.field input, .field select { height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); }
.field select { padding: 0 10px; }
.field input, .field select { height: 40px; padding-left: 12px; border-radius: 8px; border: 1px solid var(--line-strong); background-color: var(--surface); }
.field input { padding-right: 12px; }
.account { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 8px; background: var(--rail); }
.account input { flex: 1; min-width: 0; height: 32px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); padding: 0 8px; }
.links { display: flex; gap: 12px; }
Expand Down
6 changes: 3 additions & 3 deletions apps/extension/entrypoints/popup/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ body { width: 360px; }
.queued-dot { width: 10px; height: 10px; flex: none; border-radius: 5px; background: #9A5536; }
.chip-static { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 12px; background: var(--chip); font-size: 12px; }

.popup { max-height: 460px; display: flex; flex-direction: column; overflow: hidden; }
/* As tall as Chrome lets a popup be (600): with Lists above the tags, 460 put Later, Archive and Open under a scroll. */
.popup { max-height: 600px; display: flex; flex-direction: column; overflow: hidden; }
/* The wordmark opens Pluck; the cog opens Options. */
.bar { height: 40px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 10px 0 12px; border-bottom: 1px solid var(--line); }
.home { display: flex; align-items: center; height: 28px; padding: 0 4px; border: 0; border-radius: 6px; background: none; color: var(--ink); }
Expand All @@ -36,8 +37,7 @@ body { width: 360px; }
.body { display: flex; flex-direction: column; gap: 12px; padding: 12px 16px; flex: 1; overflow-y: auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 12px; color: var(--ink2); }
input[type="text"], select { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; }
select { padding: 0 8px; }
input[type="text"] { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.field > .chips { margin-top: 0; } /* the Lists: chips under their own label, with no field between */
.chip { height: 28px; padding: 0 10px; border-radius: 14px; border: 0; background: var(--chip); font-size: 12px; }
Expand Down
8 changes: 8 additions & 0 deletions apps/extension/lib/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-ui); font-size: 14px; line-height: 20px; }
button, input, select { font: inherit; color: inherit; }
/* One select, as on the web (apps/web/app/globals.css): the native arrow sat flush with the right edge, so the
chevron is drawn, 12 in from it. Rules after this one set `background-color` and one side's padding, never the
shorthands, which would wipe it. */
select {
appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 36px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%238A9284' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 12px;
}
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
a { color: var(--ink); }
Expand Down
2 changes: 1 addition & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@pluck/extension",
"description": "The Pluck browser extension: pluck the page you are on, a link, an image or a selection.",
"repository": { "type": "git", "url": "https://github.com/codu-code/pluck.git", "directory": "apps/extension" },
"version": "0.2.5",
"version": "0.2.6",
"private": true,
"license": "Apache-2.0",
"type": "module",
Expand Down
Binary file modified apps/extension/store/1-pluck-this-page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/extension/store/2-your-inbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/extension/store/3-the-reader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion apps/extension/store/listing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chrome Web Store listing

What to paste into each field of the developer dashboard. The zip is `pnpm --filter @pluck/extension zip` (`.output/pluckextension-<version>-chrome.zip`); build it without `PLUCK_LOCAL`. Images are in this folder.
What to paste into each field of the developer dashboard. The zip is `pnpm --filter @pluck/extension zip` (`.output/pluckextension-<version>-chrome.zip`); build it without `PLUCK_LOCAL`. Images are in this folder; the three screenshots are taken from the real extension and web app by `node scripts/store-chrome.mjs` (its header says what it needs), so make them again when either changes.

## Store listing

Expand Down
34 changes: 34 additions & 0 deletions packages/extract/fixtures/pages/store/field-notes.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>The case for a shorter reading list</title>
<meta name="description" content="Most of what we keep to read later, we never read. A shorter list fixes that.">
<meta property="og:site_name" content="Field Notes">
<meta name="author" content="Sam Rowe">
<style>
body { margin: 0; background: #FBFAF6; color: #1C1B18; font-family: Georgia, "Times New Roman", serif; }
header { height: 59px; display: flex; align-items: center; padding: 0 48px; border-bottom: 1px solid #E4E1D8; font: 600 20px/1 system-ui, -apple-system, "Helvetica Neue", sans-serif; }
main { max-width: 680px; padding: 48px 0 0 120px; }
.label { font: 500 13px/1 system-ui, -apple-system, "Helvetica Neue", sans-serif; letter-spacing: 0.06em; text-transform: uppercase; color: #8A4B2A; }
h1 { margin: 14px 0 12px; font-size: 48px; line-height: 52px; letter-spacing: -0.01em; }
.by { font: 14px/20px system-ui, -apple-system, "Helvetica Neue", sans-serif; color: #55534C; }
p { margin: 28px 0 0; font-size: 20px; line-height: 32px; }
p.by { margin: 0; }
</style>
</head>
<body>
<header>Field Notes</header>
<main>
<article>
<span class="label">Essay</span>
<h1>The case for a shorter reading list</h1>
<p class="by">By Sam Rowe · 8 min read</p>
<p>Most of what we keep to read later, we never read. The list grows by a dozen links a week and shrinks by two, and after a year it is less a list than a record of good intentions.</p>
<p>The fix is not a better way to file things. It is a habit of letting things go: keep what you plucked this week close, move the rest out of sight, and trust that anything important will come back.</p>
<p>A short list is one you can finish. A list you can finish is one you will open.</p>
</article>
</main>
</body>
</html>
90 changes: 90 additions & 0 deletions scripts/store-chrome.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// The Chrome Web Store's three screenshots (1280 × 800), taken from the real extension and the real web app, so the
// listing shows them as they ship: 1 the popup over a page it has just plucked, 2 the Inbox, 3 the reader.
//
// Needs a local server running a production build (`next dev` draws its own badge on the page) with a demo library
// (`node scripts/demo-seed.mjs <server> <email>`, which prints the key; a fresh one each time, since a page already
// in the library is not plucked again), the fixture pages (`pnpm stack`), and the extension built for a local server:
// PLUCK_LOCAL=1 pnpm --filter @pluck/extension build
// Usage: node scripts/store-chrome.mjs <server> <email> <api key>
// Writes apps/extension/store/1-pluck-this-page.png, 2-your-inbox.png and 3-the-reader.png.
import { writeFileSync } from "node:fs";
import { join } from "node:path";
import { chromium } from "@playwright/test";

const root = join(import.meta.dirname, "..");
const [server, email, key] = process.argv.slice(2);
if (!server || !email || !key) throw new Error("Usage: node scripts/store-chrome.mjs <server> <email> <api key>");
const MAILPIT = "http://127.0.0.1:8035";
const PAGE = `${process.env.PLUCK_FIXTURES ?? "http://127.0.0.1:4180"}/store/field-notes.html`;
const EXTENSION = join(root, "apps/extension/.output/chrome-mv3");
const out = (name) => join(root, "apps/extension/store", name);
const size = { width: 1280, height: 800 };

const context = await chromium.launchPersistentContext("", {
channel: "chromium", viewport: size, args: [`--disable-extensions-except=${EXTENSION}`, `--load-extension=${EXTENSION}`],
});
const sw = context.serviceWorkers()[0] ?? (await context.waitForEvent("serviceworker"));
const extId = new URL(sw.url()).host;
await sw.evaluate(async ({ key, server }) => {
await chrome.storage.local.set({ settings: { server, defaultKind: "guess", sendContent: true, transcripts: true }, apiKey: key, seenTips: true });
}, { key, server });

// Sign the browser in as the same person, through the real email link.
const page = context.pages()[0] ?? (await context.newPage());
const sent = Date.now();
await page.request.post(`${server}/api/auth/sign-in/magic-link`, { headers: { origin: server }, data: { email, callbackURL: "/inbox" } });
let link;
for (let i = 0; i < 40 && !link; i++) {
const { messages } = await (await fetch(`${MAILPIT}/api/v1/search?query=${encodeURIComponent(`to:"${email}"`)}`)).json();
const fresh = messages.find((m) => new Date(m.Created).getTime() >= sent - 1000);
if (fresh) link = (await (await fetch(`${MAILPIT}/api/v1/message/${fresh.ID}`)).json()).Text.match(/https?:\/\/\S+/)?.[0];
else await new Promise((r) => setTimeout(r, 250));
}
if (!link) throw new Error("no sign-in email arrived");
await page.goto(link.replace("/signin/link?", "/api/auth/magic-link/verify?"));
const api = async (path, data) => (await page.request[data ? "post" : "get"](`${server}${path}`, data ? { data } : undefined)).json();
await api("/api/v1/tags", { name: "reading" });

// 1. The page, and the popup that has just plucked it, with a List and a tag tapped on.
await page.goto(PAGE);
const behind = await page.screenshot({ type: "png" });
const tabId = await sw.evaluate(async (url) => (await chrome.tabs.query({ url }))[0].id, PAGE);
const popup = await context.newPage();
await popup.setViewportSize({ width: 360, height: 600 });
await popup.goto(`chrome-extension://${extId}/popup.html?tab=${tabId}`);
await popup.getByRole("status").filter({ hasText: "Plucked" }).waitFor();
await popup.getByRole("group", { name: "Lists" }).getByRole("button").first().click();
await popup.getByRole("button", { name: "reading", exact: true }).click();
await popup.getByRole("button", { name: "reading", exact: true }).and(popup.locator("[aria-pressed=true]")).waitFor();
await popup.mouse.move(0, 599);
const card = await popup.locator(".popup").screenshot({ type: "png" });
await popup.close();
const data = (png) => `data:image/png;base64,${png.toString("base64")}`;
await page.setContent(
`<body style="margin:0;width:1280px;height:800px;background:url(${data(behind)}) no-repeat">` +
// Where Chrome hangs a popup: under the toolbar, at the right. Its own border and shadow, as the browser draws them.
`<img src="${data(card)}" style="position:absolute;top:12px;right:16px;width:360px;border-radius:12px;border:1px solid #D3D9CE;box-shadow:0 12px 32px rgba(21,26,19,0.16)"></body>`,
);
writeFileSync(out("1-pluck-this-page.png"), await page.screenshot({ type: "png" }));

// 2. The Inbox, the pointer on the page just plucked so its row shows what can be done with it. Not at once: a row
// plucked in the last few seconds is drawn as just landed, and the library was seeded a moment ago.
await page.waitForTimeout(6000);
// A demo link with nothing to say for itself shows its address on its row, and here that is a local one: out of the picture.
for (const i of (await api("/api/v1/items?status=inbox&limit=50")).items)
if (i.url && !i.excerpt) await page.request.patch(`${server}/api/v1/items/${i.id}`, { data: { status: "archived" } });
await page.goto(`${server}/inbox`);
const row = page.getByRole("listitem").first();
await row.waitFor();
await row.hover();
writeFileSync(out("2-your-inbox.png"), await page.screenshot({ type: "png" }));

// 3. The reader, on that page.
const { items } = await api("/api/v1/items?status=inbox&limit=1");
await page.goto(`${server}/items/${items[0].id}`);
await page.getByRole("article").waitFor();
await page.mouse.move(640, 700);
writeFileSync(out("3-the-reader.png"), await page.screenshot({ type: "png" }));

await context.close();
console.log("Three Chrome Web Store screenshots written to apps/extension/store.");
Loading