generated from lobehub/chat-plugin-template
-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
216 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { createStyles } from 'antd-style'; | ||
import { memo, useMemo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import { midjourneySelectors, useStore } from '@/store'; | ||
|
||
import ImagineAction from './ImagineAction'; | ||
|
||
const useStyles = createStyles(({ css }) => ({ | ||
container: css` | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
`, | ||
})); | ||
|
||
const Actions = memo(() => { | ||
const currentTask = useStore(midjourneySelectors.currentActiveTask); | ||
const { styles } = useStyles(); | ||
const content = useMemo(() => { | ||
switch (currentTask?.action) { | ||
case 'IMAGINE': { | ||
return <ImagineAction />; | ||
} | ||
case 'UPSCALE': { | ||
break; | ||
} | ||
case 'VARIATION': { | ||
break; | ||
} | ||
case 'REROLL': { | ||
break; | ||
} | ||
case 'DESCRIBE': { | ||
break; | ||
} | ||
case 'BLEND': { | ||
break; | ||
} | ||
} | ||
}, [currentTask?.action]); | ||
|
||
return <Flexbox className={styles.container}>{content}</Flexbox>; | ||
}); | ||
|
||
export default Actions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { Button } from 'antd'; | ||
import { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
const ImageAction = memo(() => { | ||
return ( | ||
<Flexbox gap={8} horizontal> | ||
<Button type={'primary'}>高清化</Button> | ||
<Button>风格化</Button> | ||
</Flexbox> | ||
); | ||
}); | ||
|
||
export default ImageAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Progress } from 'antd'; | ||
import { createStyles } from 'antd-style'; | ||
import { memo } from 'react'; | ||
import { Flexbox } from 'react-layout-kit'; | ||
|
||
import { midjourneySelectors, useStore } from '@/store'; | ||
|
||
import ImagePreview from './Image'; | ||
|
||
const useStyles = createStyles(({ css, token }) => ({ | ||
container: css` | ||
overflow: hidden; | ||
background: ${token.colorFillTertiary}; | ||
border-radius: 24px; | ||
`, | ||
})); | ||
|
||
const Preview = memo(() => { | ||
const [progress, taskLoading] = useStore((s) => [ | ||
midjourneySelectors.currentTaskProgress(s), | ||
midjourneySelectors.isCurrentTaskRunning(s), | ||
]); | ||
|
||
const { styles } = useStyles(); | ||
const currentTask = useStore(midjourneySelectors.currentActiveTask); | ||
|
||
return ( | ||
(taskLoading || currentTask?.imageUrl) && ( | ||
<Flexbox | ||
className={styles.container} | ||
flex={1} | ||
gap={8} | ||
height={'calc(100vh - 80px - 64px - 8*2px - 2*16px )'} | ||
padding={16} | ||
> | ||
<ImagePreview /> | ||
{progress !== 100 && <Progress percent={progress} />} | ||
</Flexbox> | ||
) | ||
); | ||
}); | ||
|
||
export default Preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters