🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
'use client';
import { Block, Button, Flexbox, Text } from '@lobehub/ui';
import React, { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import AuthCard from '@/features/AuthCard';
import ThirdPartyNotice from '../OAuthConsent/ThirdPartyNotice';
interface DeviceCodeConfirmProps {
clientName: string;
developerName?: string;
isFirstParty?: boolean;
policyUri?: string;
userCode: string;
xsrf?: string;
}
const DeviceCodeConfirm = memo<DeviceCodeConfirmProps>(
({ xsrf, userCode, clientName, developerName, isFirstParty, policyUri }) => {
const { t } = useTranslation('oauth');
const [isLoading, setIsLoading] = useState(false);
return (
<AuthCard
subtitle={t('device.confirm.description', { clientName })}
title={t('device.confirm.title')}
footer={
<form action="/oidc/device" method="post" style={{ width: '100%' }}>
{xsrf && <input name="xsrf" type="hidden" value={xsrf} />}
<input name="user_code" type="hidden" value={userCode} />
<input name="confirm" type="hidden" value="yes" />
<Flexbox gap={12}>
<Button
block
htmlType="submit"
loading={isLoading}
size="large"
type="primary"
onClick={() => setIsLoading(true)}
>
{t('device.confirm.authorize')}
</Button>
<Button block htmlType="submit" name="abort" size="large" value="yes">
{t('device.confirm.deny')}
</Button>
</Flexbox>
</form>
}
>
{isFirstParty === false && (
<Flexbox style={{ marginBottom: 16 }}>
<ThirdPartyNotice developerName={developerName} policyUri={policyUri} />
</Flexbox>
)}
<Block padding={16} variant="filled">
<Text
style={{
fontFamily: 'monospace',
fontSize: 24,
fontWeight: 'bold',
letterSpacing: '0.15em',
textAlign: 'center',
}}
>
{userCode}
</Text>
</Block>
<Text style={{ marginTop: 8 }} type="secondary">
{t('device.confirm.codeHint')}
</Text>
</AuthCard>
);
},
);
DeviceCodeConfirm.displayName = 'DeviceCodeConfirm';
export default DeviceCodeConfirm;