Skip to content

🀯 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.

πŸ’„ style(self-learning): flow a lit border on the new-domain input while generating (#18515)

Arvin Xu73d6994c1f22
diff --git a/src/features/SelfLearning/CreateDomainPage.tsx b/src/features/SelfLearning/CreateDomainPage.tsx
index 19bd7dfd39e..79df8d542c4 100644
--- a/src/features/SelfLearning/CreateDomainPage.tsx
+++ b/src/features/SelfLearning/CreateDomainPage.tsx
@@ -3,7 +3,7 @@
import { ActionIcon, Flexbox, Icon, Input, Text, TextArea } from '@lobehub/ui';
import { Button, Popover, toast } from '@lobehub/ui/base-ui';
import { Divider } from 'antd';
-import { createStaticStyles, cssVar } from 'antd-style';
+import { createGlobalStyle, createStaticStyles, cssVar } from 'antd-style';
import {
AnchorIcon,
ArrowLeftIcon,
@@ -117,6 +117,67 @@ const styles = createStaticStyles(({ css }) => ({
overflow: hidden;
height: 22px;
`,
+ // Wraps the brief textarea so the loading state can draw the same flowing
+ // border the goal creator uses β€” the shell owns the ring, not the input.
+ inputShell: css`
+ position: relative;
+ border-radius: 8px;
+ `,
+ // Only while generating: a conic-gradient ring rotated by the animated
+ // --domain-border-angle, masked to a 2px edge so the textarea reads as lit.
+ // `overflow: hidden` lives here, not on the resting shell, so the outlined
+ // textarea's focus glow isn't clipped when the user is typing.
+ inputShellLoading: css`
+ overflow: hidden;
+
+ &::after {
+ pointer-events: none;
+ content: '';
+
+ position: absolute;
+ z-index: 1;
+ inset: 0;
+
+ padding: 2px;
+ border-radius: inherit;
+
+ background: conic-gradient(
+ from var(--domain-border-angle),
+ ${cssVar.colorBorderSecondary} 0deg 210deg,
+ #ff3d8d 238deg,
+ #8b5cf6 258deg,
+ #00c8ff 278deg,
+ #22e6a8 298deg,
+ #ffd43b 318deg,
+ #ff6b35 338deg,
+ ${cssVar.colorBorderSecondary} 360deg
+ );
+
+ mask:
+ linear-gradient(#fff 0 0) content-box,
+ linear-gradient(#fff 0 0);
+
+ animation: domain-input-flow 1.8s linear infinite;
+
+ mask-composite: exclude;
+ }
+
+ @keyframes domain-input-flow {
+ from {
+ --domain-border-angle: 0deg;
+ }
+
+ to {
+ --domain-border-angle: 360deg;
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ &::after {
+ animation: none;
+ }
+ }
+ `,
itemRow: css`
display: grid;
grid-template-columns: 32px minmax(0, 1fr) 28px;
@@ -174,6 +235,16 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
+// A registered custom property is what lets the conic gradient's angle animate
+// at all β€” a plain `--domain-border-angle` is an un-typed string CSS can't tween.
+const DomainBorderFlowStyle = createGlobalStyle`
+ @property --domain-border-angle {
+ inherits: false;
+ initial-value: 0deg;
+ syntax: '<angle>';
+ }
+`;
+
export const formatRemainingTime = (seconds: number) => {
const minutes = Math.floor(seconds / 60);
const rest = seconds % 60;
@@ -390,6 +461,7 @@ const CreateDomainPage = memo(() => {
return (
<Flexbox height={'100%'} width={'100%'}>
+ <DomainBorderFlowStyle />
<NavHeader
styles={{ left: { paddingInlineStart: 24 } }}
left={
@@ -435,15 +507,19 @@ const CreateDomainPage = memo(() => {
<Text fontSize={12} type={'secondary'}>
{t('create.briefHelp')}
</Text>
- <TextArea
- autoFocus
- autoSize={{ maxRows: 10, minRows: 5 }}
- disabled={step === 'preparing'}
- placeholder={t('create.briefPlaceholder')}
- value={brief}
- variant={'outlined'}
- onChange={(e) => setBrief(e.target.value)}
- />
+ <div
+ className={`${styles.inputShell} ${step === 'preparing' ? styles.inputShellLoading : ''}`}
+ >
+ <TextArea
+ autoFocus
+ autoSize={{ maxRows: 10, minRows: 5 }}
+ disabled={step === 'preparing'}
+ placeholder={t('create.briefPlaceholder')}
+ value={brief}
+ variant={step === 'preparing' ? 'borderless' : 'outlined'}
+ onChange={(e) => setBrief(e.target.value)}
+ />
+ </div>
{step === 'preparing' ? (
<Flexbox
horizontal