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/loopover-extension/background.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { logoutExtensionSession, requestPullContext } from "./auth.js";

chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
if (!message || !["gittensory:pull-context", "gittensory:logout"].includes(message.type)) return false;
const task = message.type === "gittensory:logout" ? logoutExtensionSession() : requestPullContext(message);
if (!message || !["loopover:pull-context", "loopover:logout"].includes(message.type)) return false;
const task = message.type === "loopover:logout" ? logoutExtensionSession() : requestPullContext(message);
void task.then((payload) => sendResponse({ ok: true, payload })).catch((error) => sendResponse({ ok: false, error: error instanceof Error ? error.message : String(error) }));
return true;
});
44 changes: 22 additions & 22 deletions apps/loopover-extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ function matchPullRequestTarget(pathname) {
}

function mountOverlay(target) {
if (document.querySelector("[data-gittensory-pr-context]")) return;
if (document.querySelector("[data-loopover-pr-context]")) return;
const container = document.createElement("aside");
const host = findPullRequestSidebar();
container.className = `gittensory-overlay ${host ? "gittensory-overlay--sidebar" : "gittensory-overlay--floating"}`;
container.className = `loopover-overlay ${host ? "loopover-overlay--sidebar" : "loopover-overlay--floating"}`;
container.dataset.loopoverPrContext = "true";
container.innerHTML = `
<div class="gittensory-overlay__header">
<span class="gittensory-overlay__mark">G</span>
<div class="loopover-overlay__header">
<span class="loopover-overlay__mark">G</span>
<span>LoopOver</span>
<span class="gittensory-overlay__privacy">Private</span>
<button type="button" class="gittensory-overlay__refresh" aria-label="Refresh LoopOver context">Refresh</button>
<span class="loopover-overlay__privacy">Private</span>
<button type="button" class="loopover-overlay__refresh" aria-label="Refresh LoopOver context">Refresh</button>
</div>
<div class="gittensory-overlay__body">Loading private context...</div>
<div class="loopover-overlay__body">Loading private context...</div>
`;
if (host) {
host.prepend(container);
} else {
document.body.appendChild(container);
}
const refresh = container.querySelector(".gittensory-overlay__refresh");
const refresh = container.querySelector(".loopover-overlay__refresh");
refresh?.addEventListener("click", () => load(container, target));
void load(container, target);
}
Expand All @@ -53,12 +53,12 @@ function findPullRequestSidebar() {
}

async function load(container, target) {
const body = container.querySelector(".gittensory-overlay__body");
const body = container.querySelector(".loopover-overlay__body");
if (!body) return;
body.textContent = "Loading private context...";
const response = await chrome.runtime.sendMessage({ type: "gittensory:pull-context", ...target });
const response = await chrome.runtime.sendMessage({ type: "loopover:pull-context", ...target });
if (!response?.ok) {
body.innerHTML = `<div class="gittensory-overlay__error">${escapeHtml(response?.error || "Context unavailable")}</div>`;
body.innerHTML = `<div class="loopover-overlay__error">${escapeHtml(response?.error || "Context unavailable")}</div>`;
return;
}
body.innerHTML = renderPullContext(response.payload);
Expand All @@ -79,26 +79,26 @@ function renderSection(section) {
const actions = Array.isArray(section?.actions) ? section.actions : [];
const tone = ["good", "warn", "neutral", "private"].includes(section?.tone) ? section.tone : "neutral";
return `
<section class="gittensory-overlay__panel gittensory-overlay__panel--${tone}">
<div class="gittensory-overlay__panel-head">
<section class="loopover-overlay__panel loopover-overlay__panel--${tone}">
<div class="loopover-overlay__panel-head">
<strong>${escapeHtml(section?.label || "Panel")}</strong>
<span>${escapeHtml(section?.badge || "live")}</span>
</div>
${rows.length > 0 ? `<dl>${rows.map((row) => `<div><dt>${escapeHtml(row.label || "")}</dt><dd>${escapeHtml(row.value || "")}</dd></div>`).join("")}</dl>` : ""}
${items.length > 0 ? `<ul class="gittensory-overlay__list">${items.map((item) => `<li>${escapeHtml(item)}</li>`).join("")}</ul>` : ""}
${actions.length > 0 ? `<ol class="gittensory-overlay__actions">${actions.map((action) => `<li>${escapeHtml(action)}</li>`).join("")}</ol>` : ""}
${items.length > 0 ? `<ul class="loopover-overlay__list">${items.map((item) => `<li>${escapeHtml(item)}</li>`).join("")}</ul>` : ""}
${actions.length > 0 ? `<ol class="loopover-overlay__actions">${actions.map((action) => `<li>${escapeHtml(action)}</li>`).join("")}</ol>` : ""}
</section>
`;
}

function renderLegacyPanels(payload) {
const panels = Array.isArray(payload?.panels) ? payload.panels : [];
if (panels.length === 0) return `<div class="gittensory-overlay__empty">No cached private context is available for this pull request.</div>`;
if (panels.length === 0) return `<div class="loopover-overlay__empty">No cached private context is available for this pull request.</div>`;
return panels
.map(
(panel) => `
<section class="gittensory-overlay__panel gittensory-overlay__panel--neutral">
<div class="gittensory-overlay__panel-head">
<section class="loopover-overlay__panel loopover-overlay__panel--neutral">
<div class="loopover-overlay__panel-head">
<strong>${escapeHtml(panel.label || "Panel")}</strong>
<span>${escapeHtml(panel.badge || "live")}</span>
</div>
Expand Down Expand Up @@ -134,15 +134,15 @@ function renderActions(body, actions) {
const list = Array.isArray(actions) ? actions : [];
if (list.length === 0) return;
const container = document.createElement("section");
container.className = "gittensory-overlay__panel gittensory-overlay__panel--private";
container.className = "loopover-overlay__panel loopover-overlay__panel--private";
container.innerHTML = `
<div class="gittensory-overlay__panel-head">
<div class="loopover-overlay__panel-head">
<strong>Actions</strong>
<span>extension</span>
</div>
<div class="gittensory-overlay__action-buttons"></div>
<div class="loopover-overlay__action-buttons"></div>
`;
const actionsNode = container.querySelector(".gittensory-overlay__action-buttons");
const actionsNode = container.querySelector(".loopover-overlay__action-buttons");
if (!actionsNode) return;
for (const action of list) {
if (action?.id === "copy_public_safe_packet" && typeof action?.markdown === "string") {
Expand Down
72 changes: 36 additions & 36 deletions apps/loopover-extension/styles.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
.gittensory-overlay {
.loopover-overlay {
border: 1px solid rgba(126, 231, 188, 0.45);
border-radius: 8px;
background: #0f1117;
color: #f4f7f5;
font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.gittensory-overlay--sidebar {
.loopover-overlay--sidebar {
width: 100%;
margin-bottom: 16px;
overflow: hidden;
}

.gittensory-overlay--floating {
.loopover-overlay--floating {
position: fixed;
right: 16px;
bottom: 16px;
Expand All @@ -23,7 +23,7 @@
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.gittensory-overlay__header {
.loopover-overlay__header {
display: flex;
align-items: center;
gap: 8px;
Expand All @@ -32,7 +32,7 @@
font-weight: 650;
}

.gittensory-overlay__privacy {
.loopover-overlay__privacy {
border: 1px solid rgba(126, 231, 188, 0.35);
border-radius: 999px;
color: #7ee7bc;
Expand All @@ -43,7 +43,7 @@
text-transform: uppercase;
}

.gittensory-overlay__mark {
.loopover-overlay__mark {
display: inline-flex;
width: 22px;
height: 22px;
Expand All @@ -55,7 +55,7 @@
font-weight: 800;
}

.gittensory-overlay__refresh {
.loopover-overlay__refresh {
margin-left: auto;
border: 1px solid rgba(255, 255, 255, 0.18);
border-radius: 6px;
Expand All @@ -66,41 +66,41 @@
padding: 3px 7px;
}

.gittensory-overlay__body {
.loopover-overlay__body {
padding: 12px;
}

.gittensory-overlay__panel {
.loopover-overlay__panel {
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 7px;
padding: 10px;
}

.gittensory-overlay__panel--good {
.loopover-overlay__panel--good {
border-color: rgba(126, 231, 188, 0.35);
}

.gittensory-overlay__panel--warn {
.loopover-overlay__panel--warn {
border-color: rgba(255, 189, 105, 0.45);
}

.gittensory-overlay__panel--private {
.loopover-overlay__panel--private {
border-color: rgba(145, 181, 255, 0.38);
}

.gittensory-overlay__panel + .gittensory-overlay__panel {
.loopover-overlay__panel + .loopover-overlay__panel {
margin-top: 8px;
}

.gittensory-overlay__panel-head {
.loopover-overlay__panel-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 8px;
}

.gittensory-overlay__panel-head span {
.loopover-overlay__panel-head span {
border: 1px solid rgba(126, 231, 188, 0.4);
border-radius: 999px;
color: #7ee7bc;
Expand All @@ -109,98 +109,98 @@
text-transform: uppercase;
}

.gittensory-overlay__panel--warn .gittensory-overlay__panel-head span {
.loopover-overlay__panel--warn .loopover-overlay__panel-head span {
border-color: rgba(255, 189, 105, 0.45);
color: #ffbd69;
}

.gittensory-overlay__panel--private .gittensory-overlay__panel-head span {
.loopover-overlay__panel--private .loopover-overlay__panel-head span {
border-color: rgba(145, 181, 255, 0.45);
color: #91b5ff;
}

.gittensory-overlay dl {
.loopover-overlay dl {
margin: 0;
}

.gittensory-overlay dl div {
.loopover-overlay dl div {
display: flex;
justify-content: space-between;
gap: 12px;
}

.gittensory-overlay dt {
.loopover-overlay dt {
color: rgba(244, 247, 245, 0.62);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.gittensory-overlay dd {
.loopover-overlay dd {
margin: 0;
color: rgba(244, 247, 245, 0.9);
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
text-align: right;
overflow-wrap: anywhere;
}

.gittensory-overlay__list,
.gittensory-overlay__actions {
.loopover-overlay__list,
.loopover-overlay__actions {
margin: 8px 0 0;
padding-left: 18px;
}

.gittensory-overlay__list li,
.gittensory-overlay__actions li {
.loopover-overlay__list li,
.loopover-overlay__actions li {
color: rgba(244, 247, 245, 0.78);
margin-top: 4px;
}

.gittensory-overlay__actions li {
.loopover-overlay__actions li {
color: rgba(244, 247, 245, 0.9);
}

.gittensory-overlay__action-buttons {
.loopover-overlay__action-buttons {
display: grid;
gap: 8px;
}

.gittensory-overlay__action-buttons button,
.gittensory-overlay__action-buttons details {
.loopover-overlay__action-buttons button,
.loopover-overlay__action-buttons details {
border: 1px solid rgba(145, 181, 255, 0.32);
border-radius: 6px;
background: rgba(145, 181, 255, 0.08);
color: #f4f7f5;
font: inherit;
}

.gittensory-overlay__action-buttons button {
.loopover-overlay__action-buttons button {
cursor: pointer;
padding: 7px 9px;
text-align: left;
}

.gittensory-overlay__action-buttons details {
.loopover-overlay__action-buttons details {
padding: 7px 9px;
}

.gittensory-overlay__action-buttons summary {
.loopover-overlay__action-buttons summary {
cursor: pointer;
font-weight: 650;
}

.gittensory-overlay__action-buttons ul {
.loopover-overlay__action-buttons ul {
margin: 6px 0 0;
padding-left: 18px;
}

.gittensory-overlay__action-buttons li {
.loopover-overlay__action-buttons li {
color: rgba(244, 247, 245, 0.82);
margin-top: 4px;
}

.gittensory-overlay__error {
.loopover-overlay__error {
color: #ffb4a8;
}

.gittensory-overlay__empty {
.loopover-overlay__empty {
color: rgba(244, 247, 245, 0.72);
}
10 changes: 5 additions & 5 deletions apps/loopover-miner-extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import "./toolbar-badge.js";
const badgeApi = globalThis.__loopoverMinerOpportunityBadge;
const toolbarBadgeApi = globalThis.__loopoverMinerToolbarBadge;

const PING_MESSAGE = "gittensory-miner:ping";
const ISSUE_CONTEXT_MESSAGE = "gittensory-miner:issue-context";
const SYNC_RANKED_CANDIDATES_MESSAGE = "gittensory-miner:sync-ranked-candidates";
const PING_MESSAGE = "loopover-miner:ping";
const ISSUE_CONTEXT_MESSAGE = "loopover-miner:issue-context";
const SYNC_RANKED_CANDIDATES_MESSAGE = "loopover-miner:sync-ranked-candidates";

chrome.runtime.onMessage.addListener((message, _sender, sendResponse) => {
if (!message || typeof message.type !== "string") return false;
Expand Down Expand Up @@ -85,7 +85,7 @@ async function loadRankedCandidates() {
}

const DEFAULT_MINER_UI_URL = "http://localhost:5174";
const SYNC_ALARM_NAME = "gittensory-miner:sync-ranked-candidates";
const SYNC_ALARM_NAME = "loopover-miner:sync-ranked-candidates";
const SYNC_ALARM_PERIOD_MINUTES = 10;

async function loadMinerUiUrl() {
Expand Down Expand Up @@ -158,7 +158,7 @@ async function refreshToolbarBadge() {
await chrome.action.setBadgeText({ text: badge.text });
await chrome.action.setBadgeBackgroundColor({ color: badge.backgroundColor });
} catch (error) {
console.warn("gittensory-miner: failed to refresh toolbar badge", error);
console.warn("loopover-miner: failed to refresh toolbar badge", error);
}
}

Expand Down
8 changes: 4 additions & 4 deletions apps/loopover-miner-extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ function matchGitHubIssueTarget(pathname) {
}

function mountOpportunityBadge(target) {
if (document.querySelector("[data-gittensory-miner-opportunity-badge]")) return;
if (document.querySelector("[data-loopover-miner-opportunity-badge]")) return;
const host = findIssueSidebar();
const container = document.createElement("aside");
container.className = host
? "gittensory-miner-opportunity-badge"
: "gittensory-miner-opportunity-badge gittensory-miner-opportunity-badge--floating";
? "loopover-miner-opportunity-badge"
: "loopover-miner-opportunity-badge loopover-miner-opportunity-badge--floating";
container.dataset.loopoverMinerOpportunityBadge = "true";
container.hidden = true;
if (host) {
Expand All @@ -41,7 +41,7 @@ function findIssueSidebar() {

async function loadOpportunityBadge(container, target) {
const response = await chrome.runtime.sendMessage({
type: "gittensory-miner:issue-context",
type: "loopover-miner:issue-context",
owner: target.owner,
repo: target.repo,
issueNumber: target.issueNumber,
Expand Down
Loading
Loading