Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit Β·
659c746
1
Parent(s): 9ea884b
fix: onboarding join org in iframe, sign-in on direct access
Browse filesIframe shows org join step first, then redirects to Space.
Direct access shows sign-in with org access note.
Remove backend org membership check β OAuth orgIds handles it.
frontend/src/components/WelcomeScreen/WelcomeScreen.tsx
CHANGED
|
@@ -23,7 +23,7 @@ export default function WelcomeScreen() {
|
|
| 23 |
const { setPlan, clearPanel, user } = useAgentStore();
|
| 24 |
const [isCreating, setIsCreating] = useState(false);
|
| 25 |
const [error, setError] = useState<string | null>(null);
|
| 26 |
-
const [
|
| 27 |
|
| 28 |
const inIframe = isInIframe();
|
| 29 |
const isAuthenticated = user?.authenticated;
|
|
@@ -96,12 +96,6 @@ export default function WelcomeScreen() {
|
|
| 96 |
},
|
| 97 |
};
|
| 98 |
|
| 99 |
-
// Which screen to show
|
| 100 |
-
const showJoinOrg = !isAuthenticated && !isDevUser && !inIframe && !joinedOrg;
|
| 101 |
-
const showSignin = !isAuthenticated && !isDevUser && !inIframe && joinedOrg;
|
| 102 |
-
const showIframe = !isAuthenticated && !isDevUser && inIframe;
|
| 103 |
-
const showReady = isAuthenticated || isDevUser;
|
| 104 |
-
|
| 105 |
return (
|
| 106 |
<Box
|
| 107 |
sx={{
|
|
@@ -137,8 +131,8 @@ export default function WelcomeScreen() {
|
|
| 137 |
HF Agent
|
| 138 |
</Typography>
|
| 139 |
|
| 140 |
-
{/* ββ
|
| 141 |
-
{
|
| 142 |
<>
|
| 143 |
<Typography
|
| 144 |
variant="body1"
|
|
@@ -161,6 +155,8 @@ export default function WelcomeScreen() {
|
|
| 161 |
size="large"
|
| 162 |
component="a"
|
| 163 |
href={ORG_JOIN_URL}
|
|
|
|
|
|
|
| 164 |
startIcon={<GroupAddIcon />}
|
| 165 |
sx={primaryBtnSx}
|
| 166 |
>
|
|
@@ -170,7 +166,7 @@ export default function WelcomeScreen() {
|
|
| 170 |
<Button
|
| 171 |
variant="text"
|
| 172 |
size="small"
|
| 173 |
-
onClick={() =>
|
| 174 |
sx={{
|
| 175 |
mt: 2,
|
| 176 |
color: 'var(--muted-text)',
|
|
@@ -184,66 +180,45 @@ export default function WelcomeScreen() {
|
|
| 184 |
</>
|
| 185 |
)}
|
| 186 |
|
| 187 |
-
{/* ββ
|
| 188 |
-
{
|
| 189 |
<>
|
| 190 |
<Typography
|
| 191 |
variant="body1"
|
| 192 |
sx={{
|
| 193 |
color: 'var(--muted-text)',
|
| 194 |
-
maxWidth:
|
| 195 |
-
mb:
|
| 196 |
lineHeight: 1.8,
|
| 197 |
fontSize: '0.95rem',
|
| 198 |
textAlign: 'center',
|
| 199 |
px: 2,
|
|
|
|
| 200 |
}}
|
| 201 |
>
|
| 202 |
-
|
|
|
|
|
|
|
|
|
|
| 203 |
</Typography>
|
| 204 |
|
| 205 |
<Button
|
| 206 |
variant="contained"
|
| 207 |
size="large"
|
| 208 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
sx={primaryBtnSx}
|
| 210 |
>
|
| 211 |
-
|
| 212 |
-
</Button>
|
| 213 |
-
|
| 214 |
-
<Typography
|
| 215 |
-
variant="caption"
|
| 216 |
-
sx={{
|
| 217 |
-
mt: 2.5,
|
| 218 |
-
color: 'var(--muted-text)',
|
| 219 |
-
fontSize: '0.78rem',
|
| 220 |
-
textAlign: 'center',
|
| 221 |
-
maxWidth: 360,
|
| 222 |
-
lineHeight: 1.6,
|
| 223 |
-
}}
|
| 224 |
-
>
|
| 225 |
-
Make sure to enable access to the <strong>ml-agent-explorers</strong> org when prompted.
|
| 226 |
-
</Typography>
|
| 227 |
-
|
| 228 |
-
<Button
|
| 229 |
-
variant="text"
|
| 230 |
-
size="small"
|
| 231 |
-
onClick={() => setJoinedOrg(false)}
|
| 232 |
-
sx={{
|
| 233 |
-
mt: 1.5,
|
| 234 |
-
color: 'var(--muted-text)',
|
| 235 |
-
textTransform: 'none',
|
| 236 |
-
fontSize: '0.85rem',
|
| 237 |
-
'&:hover': { color: 'var(--text)' },
|
| 238 |
-
}}
|
| 239 |
-
>
|
| 240 |
-
β Back
|
| 241 |
</Button>
|
| 242 |
</>
|
| 243 |
)}
|
| 244 |
|
| 245 |
-
{/* ββ
|
| 246 |
-
{
|
| 247 |
<>
|
| 248 |
<Typography
|
| 249 |
variant="body1"
|
|
@@ -267,20 +242,30 @@ export default function WelcomeScreen() {
|
|
| 267 |
<Button
|
| 268 |
variant="contained"
|
| 269 |
size="large"
|
| 270 |
-
|
| 271 |
-
href={spaceHost}
|
| 272 |
-
target="_blank"
|
| 273 |
-
rel="noopener noreferrer"
|
| 274 |
-
endIcon={<OpenInNewIcon />}
|
| 275 |
sx={primaryBtnSx}
|
| 276 |
>
|
| 277 |
-
|
| 278 |
</Button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 279 |
</>
|
| 280 |
)}
|
| 281 |
|
| 282 |
-
{/* ββ
|
| 283 |
-
{
|
| 284 |
<>
|
| 285 |
<Typography
|
| 286 |
variant="body1"
|
|
|
|
| 23 |
const { setPlan, clearPanel, user } = useAgentStore();
|
| 24 |
const [isCreating, setIsCreating] = useState(false);
|
| 25 |
const [error, setError] = useState<string | null>(null);
|
| 26 |
+
const [iframeJoined, setIframeJoined] = useState(false);
|
| 27 |
|
| 28 |
const inIframe = isInIframe();
|
| 29 |
const isAuthenticated = user?.authenticated;
|
|
|
|
| 96 |
},
|
| 97 |
};
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
return (
|
| 100 |
<Box
|
| 101 |
sx={{
|
|
|
|
| 131 |
HF Agent
|
| 132 |
</Typography>
|
| 133 |
|
| 134 |
+
{/* ββ Iframe: join org β then redirect to Space ββββββββββββββ */}
|
| 135 |
+
{inIframe && !iframeJoined && (
|
| 136 |
<>
|
| 137 |
<Typography
|
| 138 |
variant="body1"
|
|
|
|
| 155 |
size="large"
|
| 156 |
component="a"
|
| 157 |
href={ORG_JOIN_URL}
|
| 158 |
+
target="_blank"
|
| 159 |
+
rel="noopener noreferrer"
|
| 160 |
startIcon={<GroupAddIcon />}
|
| 161 |
sx={primaryBtnSx}
|
| 162 |
>
|
|
|
|
| 166 |
<Button
|
| 167 |
variant="text"
|
| 168 |
size="small"
|
| 169 |
+
onClick={() => setIframeJoined(true)}
|
| 170 |
sx={{
|
| 171 |
mt: 2,
|
| 172 |
color: 'var(--muted-text)',
|
|
|
|
| 180 |
</>
|
| 181 |
)}
|
| 182 |
|
| 183 |
+
{/* ββ Iframe: after joining β open Space βββββββββββββββββββββ */}
|
| 184 |
+
{inIframe && iframeJoined && (
|
| 185 |
<>
|
| 186 |
<Typography
|
| 187 |
variant="body1"
|
| 188 |
sx={{
|
| 189 |
color: 'var(--muted-text)',
|
| 190 |
+
maxWidth: 520,
|
| 191 |
+
mb: 5,
|
| 192 |
lineHeight: 1.8,
|
| 193 |
fontSize: '0.95rem',
|
| 194 |
textAlign: 'center',
|
| 195 |
px: 2,
|
| 196 |
+
'& strong': { color: 'var(--text)', fontWeight: 600 },
|
| 197 |
}}
|
| 198 |
>
|
| 199 |
+
A general-purpose AI agent for <strong>machine learning engineering</strong>.
|
| 200 |
+
It browses <strong>Hugging Face documentation</strong>, manages{' '}
|
| 201 |
+
<strong>repositories</strong>, launches <strong>training jobs</strong>,
|
| 202 |
+
and explores <strong>datasets</strong> β all through natural conversation.
|
| 203 |
</Typography>
|
| 204 |
|
| 205 |
<Button
|
| 206 |
variant="contained"
|
| 207 |
size="large"
|
| 208 |
+
component="a"
|
| 209 |
+
href={spaceHost}
|
| 210 |
+
target="_blank"
|
| 211 |
+
rel="noopener noreferrer"
|
| 212 |
+
endIcon={<OpenInNewIcon />}
|
| 213 |
sx={primaryBtnSx}
|
| 214 |
>
|
| 215 |
+
Open HF Agent
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
</Button>
|
| 217 |
</>
|
| 218 |
)}
|
| 219 |
|
| 220 |
+
{/* ββ Direct: not logged in β sign in ββββββββββββββββββββββββ */}
|
| 221 |
+
{!inIframe && !isAuthenticated && !isDevUser && (
|
| 222 |
<>
|
| 223 |
<Typography
|
| 224 |
variant="body1"
|
|
|
|
| 242 |
<Button
|
| 243 |
variant="contained"
|
| 244 |
size="large"
|
| 245 |
+
onClick={() => triggerLogin()}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 246 |
sx={primaryBtnSx}
|
| 247 |
>
|
| 248 |
+
Sign in with Hugging Face
|
| 249 |
</Button>
|
| 250 |
+
|
| 251 |
+
<Typography
|
| 252 |
+
variant="caption"
|
| 253 |
+
sx={{
|
| 254 |
+
mt: 2.5,
|
| 255 |
+
color: 'var(--muted-text)',
|
| 256 |
+
fontSize: '0.78rem',
|
| 257 |
+
textAlign: 'center',
|
| 258 |
+
maxWidth: 360,
|
| 259 |
+
lineHeight: 1.6,
|
| 260 |
+
}}
|
| 261 |
+
>
|
| 262 |
+
Make sure to enable access to the <strong>ml-agent-explorers</strong> org when prompted.
|
| 263 |
+
</Typography>
|
| 264 |
</>
|
| 265 |
)}
|
| 266 |
|
| 267 |
+
{/* ββ Direct: authenticated β start session ββββββββββββββββββ */}
|
| 268 |
+
{!inIframe && (isAuthenticated || isDevUser) && (
|
| 269 |
<>
|
| 270 |
<Typography
|
| 271 |
variant="body1"
|