Skip to content
Open
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
19 changes: 13 additions & 6 deletions apps/web/src/components/onboarding/WelcomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ const SCAN_LIMIT_MESSAGE = msg(
export function WelcomePage({
environmentId,
onDone,
reviewProjects = false,
}: {
readonly environmentId: EnvironmentId;
readonly onDone: (projectRef?: ScopedProjectRef) => void | Promise<void>;
readonly reviewProjects?: boolean;
}) {
const { environments } = useEnvironments();
const gt = useGT();
Expand Down Expand Up @@ -298,11 +300,14 @@ export function WelcomePage({
isPrimary={isPrimary}
onImportSourceEnabled={() => scans[0]?.refresh()}
/>
<ProjectsSection
scan={scans[0]}
projectImport={projectImport}
isImporting={isImporting}
/>
<div id={`projects:${environmentId}`}>
<ProjectsSection
scan={scans[0]}
projectImport={projectImport}
isImporting={isImporting}
initiallyReviewing={reviewProjects}
/>
</div>
{showPhone ? <PhoneSection environmentId={environmentId} /> : null}
</div>
<div className="mt-6 flex flex-wrap items-center justify-between gap-3">
Expand Down Expand Up @@ -799,15 +804,17 @@ function ProjectsSection({
scan,
projectImport,
isImporting,
initiallyReviewing,
}: {
readonly scan: ReturnType<typeof useProjectScans>[number] | undefined;
readonly projectImport: ReturnType<typeof useProjectImport>;
readonly isImporting: boolean;
readonly initiallyReviewing: boolean;
}) {
const gt = useGT();
const m = useMessages();
const importSourcesLabel = useImportSourcesLabel();
const [reviewing, setReviewing] = useState(false);
const [reviewing, setReviewing] = useState(initiallyReviewing);
const {
canWrite,
candidates,
Expand Down
22 changes: 20 additions & 2 deletions apps/web/src/components/settings/ProjectsSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import { EnvironmentId } from "@t3tools/contracts";
import { Link } from "@tanstack/react-router";
import { T, useGT } from "gt-react";
import { LayersIcon } from "lucide-react";

import { Button } from "../ui/button";
import { ProjectSettingsPanel } from "./ProjectSettingsPanel";
import { useSettingsScope } from "./SettingsScopeContext";
import { SettingsScopeNotice } from "./SettingsScopeNotice";
import { SettingsPageContainer } from "./settingsLayout";
import { SettingsPageContainer, SettingsRow } from "./settingsLayout";
import { ALL_ENVIRONMENTS_VALUE, selectEnvironmentAxis } from "./settingsScopeAxis";

export function ProjectsSettings() {
const gt = useGT();
const { search: value, scope, selectScope } = useSettingsScope();
const { search: value, scope, selectScope, environment } = useSettingsScope();
const unavailable =
scope.kind === "unavailable" ? (
<SettingsPageContainer>
Expand All @@ -38,6 +39,23 @@ export function ProjectsSettings() {
(scope.reason === "project-missing" || scope.reason === "checkout-missing"));
return (
<div className="flex min-h-0 flex-1 flex-col">
{environment ? (
<div className="shrink-0 border-b border-border/60 px-6 py-3">
<SettingsRow
title={gt("Import projects and their threads")}
description={environment.label}
control={
<Button
size="sm"
variant="outline"
render={<Link to="/welcome" hash={`projects:${environment.environmentId}`} />}
>
<T context="verb, opens a page">Open</T>
</Button>
}
/>
</div>
) : null}
{value.project && projectScope ? (
<ProjectSettingsPanel
projectKey={value.project}
Expand Down
18 changes: 12 additions & 6 deletions apps/web/src/routes/welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,24 @@ export const Route = createFileRoute("/welcome")({
function WelcomeRouteView() {
const navigate = useNavigate();
const hash = useLocation({ select: (location) => location.hash });
// A ChatGPT sign-in returns here with the computer it set up.
const resumeEnvironmentId = hash.startsWith("agents:")
? Option.getOrUndefined(decodeEnvironmentId(hash.slice("agents:".length)))
: undefined;
const reviewProjects = hash.startsWith("projects:");
// Sign-in and project import shortcuts carry the computer they were opened for.
const resumeEnvironmentId =
hash.startsWith("agents:") || reviewProjects
? Option.getOrUndefined(decodeEnvironmentId(hash.slice(hash.indexOf(":") + 1)))
: undefined;
const primaryEnvironmentId = usePrimaryEnvironmentId();
const { environments, isReady } = useEnvironments();
// Trust the id only once the catalog has it; an unknown computer falls back to this one.
// Trust the id only once the catalog has it.
const waitingForCatalog =
!isReady && (resumeEnvironmentId !== undefined || primaryEnvironmentId === null);
const resumeKnown =
resumeEnvironmentId !== undefined &&
environments.some((environment) => environment.environmentId === resumeEnvironmentId);
const environmentId = (resumeKnown ? resumeEnvironmentId : undefined) ?? primaryEnvironmentId;
// An import shortcut must never silently switch to a different computer.
const environmentId =
(resumeKnown ? resumeEnvironmentId : undefined) ??
(reviewProjects ? null : primaryEnvironmentId);
// The root can remount this pending outlet after navigation; do not reopen setup.
const isWelcomeRoute = useLocation({ select: (location) => location.pathname === "/welcome" });
const [dismissed, setDismissed] = useState(false);
Expand All @@ -47,6 +52,7 @@ function WelcomeRouteView() {
<WelcomePage
key={environmentId}
environmentId={environmentId}
reviewProjects={reviewProjects}
onDone={async (projectRef) => {
setDismissed(true);
if (projectRef !== undefined) {
Expand Down
4 changes: 4 additions & 0 deletions docs/user/welcome-page.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and the phone app. Only an agent is needed to start chatting.
To see the page again, go to **Settings → About → Welcome page** and select
**Open**. Direct links, such as Settings, open normally before setup is done.

To import more projects and conversations, open **Settings → Projects → Import projects
and their threads**. The shortcut shows the computer whose history will be scanned and opens
the full project list for review. Select another environment in Settings to import from it.

The hosted app at app.t3.codes does not open the page. With no computer connected,
it asks you to sign in to T3 Connect, then to install T3 Code and run
`t3 connect` on your computer. From home, it adds compatible computers linked to your account and
Expand Down
Loading