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
17 changes: 15 additions & 2 deletions app/src/client/pages/AppsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ export function AppsPage({
}) {
const desk = useDesk(settings);
const [saving, setSaving] = useState(false);
const [callbackError] = useState(() => {
const err = new URLSearchParams(location.search).get("error");
if (err) history.replaceState(null, "", "/apps");
return err;
});

// Reconcile connections on arrival so statuses and any pending Google
// consent link are current, not left over from the last visit.
Expand Down Expand Up @@ -76,6 +81,14 @@ export function AppsPage({
<span className="hand">read and act on</span> — flip them anytime.
</p>

{callbackError && (
<div className="conflict-note" style={{ marginBottom: 18 }}>
<span className="lead">that didn't finish — </span>
connecting Google Calendar failed: {callbackError}. Toggle it off
and on to get a fresh link, then try again.
</div>
)}

<div className="paper-card">
<h3>Signed in</h3>
<div className="field-row">
Expand Down Expand Up @@ -121,10 +134,10 @@ export function AppsPage({
<span className={status.cls}>{status.text}</span>
{on && desk.deskState?.authUrls?.[app.key] && (
<a
className="cta"
className="connect-btn"
href={desk.deskState.authUrls[app.key]}
>
Connect with Google
Connect with Google
</a>
)}
<button
Expand Down
8 changes: 5 additions & 3 deletions app/src/client/pages/ChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export function ChatPage({
}
});

async function ensureSetup() {
if (appliedRef.current === settingsHash) return;
async function ensureSetup(force = false) {
if (!force && appliedRef.current === settingsHash) return;
appliedRef.current = settingsHash;
try {
await agent.ready;
Expand Down Expand Up @@ -112,7 +112,9 @@ export function ChatPage({
title: firstTitle(messages) ?? text.slice(0, 48),
at: Date.now(),
});
await ensureSetup();
// Force a reconcile so connections made since the last message (like a
// Google Calendar consent finished on My apps) are live for this turn.
await ensureSetup(true);
void sendMessage({ text });
}

Expand Down
17 changes: 17 additions & 0 deletions app/src/client/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1036,9 +1036,26 @@ textarea {
.app-card .foot {
display: flex;
align-items: center;
gap: 10px;
justify-content: space-between;
padding-top: 4px;
}
.app-card .connect-btn {
margin-left: auto;
padding: 7px 14px;
border-radius: 999px;
background: var(--ink);
color: #fff;
font-size: 13px;
font-weight: 600;
text-decoration: none;
white-space: nowrap;
transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.app-card .connect-btn:hover {
transform: translateY(-1px);
box-shadow: var(--shadow-card);
}
.app-card .status {
font-size: 12px;
color: var(--ink-faint);
Expand Down
Loading