forked from 79E/ChatGpt-Web
-
Notifications
You must be signed in to change notification settings - Fork 0
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
32 changed files
with
1,183 additions
and
238 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
Empty file.
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,57 @@ | ||
import AceEditor from 'react-ace' | ||
|
||
import 'ace-builds/src-noconflict/mode-json' | ||
import 'ace-builds/src-noconflict/mode-javascript' | ||
import 'ace-builds/src-noconflict/theme-solarized_dark' | ||
import 'ace-builds/src-noconflict/ext-language_tools' | ||
|
||
import styles from './index.module.less' | ||
import { useRef } from 'react' | ||
|
||
type Props = { | ||
onLoad?: () => void; | ||
onChange?: (value: string) => void; | ||
value?: string; | ||
defaultValue?: string; | ||
mode: 'json' | 'javascript', | ||
placeholder?: string | ||
} | ||
|
||
function CodeEditor(props: Props) { | ||
const editorRef = useRef<HTMLDivElement>(null) | ||
|
||
return ( | ||
<div className={styles.jsonEditor}> | ||
<div className={styles.jsonEditor_content} ref={editorRef}> | ||
<AceEditor | ||
style={{ | ||
borderRadius: 8 | ||
}} | ||
width="100%" | ||
height="300px" | ||
value={props.value ? props.value : undefined} | ||
defaultValue={props.defaultValue} | ||
placeholder={props.placeholder} | ||
mode={props.mode} | ||
theme="solarized_dark" | ||
name="codeEditor" | ||
onLoad={props?.onLoad} | ||
onChange={props?.onChange} | ||
fontSize={14} | ||
showPrintMargin | ||
showGutter | ||
highlightActiveLine | ||
setOptions={{ | ||
enableBasicAutocompletion: false, | ||
enableLiveAutocompletion: true, | ||
enableSnippets: false, | ||
showLineNumbers: true, | ||
tabSize: 2 | ||
}} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default CodeEditor |
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,30 @@ | ||
.pluginCard{ | ||
display: flex; | ||
flex: 1; | ||
margin: 10px 0; | ||
align-items: center; | ||
img{ | ||
width: 46px; | ||
height: 46px; | ||
object-fit: contain; | ||
border: 1px solid #ddd; | ||
border-radius: 12px; | ||
margin-right: 12px; | ||
} | ||
&_info{ | ||
p { | ||
font-size: 14px; | ||
font-weight: 500; | ||
color: #333; | ||
} | ||
span{ | ||
font-size: 12px; | ||
color: #999; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 1; | ||
-webkit-box-orient: vertical; | ||
} | ||
} | ||
} |
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,19 @@ | ||
import styles from './index.module.less' | ||
|
||
function PluginCard(info: { | ||
avatar: string, | ||
name: string, | ||
description?: string, | ||
}) { | ||
return ( | ||
<div className={styles.pluginCard}> | ||
<img src={info.avatar} alt="" /> | ||
<div className={styles.pluginCard_info}> | ||
<p>{info.name}</p> | ||
<span>{info.description}</span> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default PluginCard; |
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,105 @@ | ||
.appCard{ | ||
box-sizing: border-box; | ||
padding: 8px 12px; | ||
border: 1px solid #dedede; | ||
max-height: 132px; | ||
min-height: 132px; | ||
border-radius: 12px; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
&_header{ | ||
display: flex; | ||
align-items: center; | ||
} | ||
&_icon{ | ||
height: 36px; | ||
min-height: 36px; | ||
width: 36px; | ||
min-width: 36px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: 1px solid #dedede; | ||
box-shadow: 0px 2px 4px 0px rgba(0,0,0,.05); | ||
border-radius: 12px; | ||
img { | ||
width: 100%; | ||
height: auto; | ||
} | ||
} | ||
&_text{ | ||
margin-left: 12px; | ||
display: flex; | ||
justify-content: center; | ||
flex-direction: column; | ||
p{ | ||
font-weight: 500; | ||
font-size: 14px; | ||
color: #333; | ||
line-height: 1; | ||
} | ||
span { | ||
width: 100%; | ||
max-width: 500px; | ||
text-overflow: ellipsis; | ||
overflow: hidden; | ||
white-space: nowrap; | ||
margin-top: 4px; | ||
font-size: 12px; | ||
color: #999; | ||
line-height: 1; | ||
} | ||
} | ||
&_description{ | ||
margin: 8px 0; | ||
font-size: 12px; | ||
color: #999; | ||
display: -webkit-box; | ||
-webkit-line-clamp: 2; /* 设置最大显示行数为 2 */ | ||
-webkit-box-orient: vertical; | ||
overflow: hidden; | ||
text-overflow: ellipsis; /* 超出部分显示省略号 */ | ||
} | ||
&_button{ | ||
display: flex; | ||
align-items: center; | ||
gap: 8px; | ||
margin-left: auto; | ||
p { | ||
border: 1px solid #bbb; | ||
padding: 0px 10px 0px 6px; | ||
cursor: pointer; | ||
background-color: rgba(255, 255, 255, 0); | ||
font-size: 12px; | ||
border-radius: 50px; | ||
transition: background-color 0.3s ease-in-out; | ||
&:hover{ | ||
background-color: #ddd; | ||
} | ||
span{ | ||
margin-left: 4px; | ||
} | ||
} | ||
} | ||
&_footer{ | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
margin-top: auto; | ||
&_userInfo{ | ||
display: flex; | ||
align-items: center; | ||
img{ | ||
width: 20px; | ||
height: 20px; | ||
border-radius: 50px; | ||
} | ||
span{ | ||
margin-left: 4px; | ||
font-size: 12px; | ||
color: #333; | ||
} | ||
} | ||
} | ||
} |
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,47 @@ | ||
import { Badge } from 'antd' | ||
import styles from './index.module.less' | ||
import { UserInfo } from '@/types' | ||
import { getEmailPre } from '@/utils' | ||
import React from 'react' | ||
|
||
type Props = { | ||
id: string | number | ||
avatar: string | ||
title: string | ||
message?: string | ||
description?: string | ||
status?: number | ||
userInfo?: UserInfo | ||
buttons: Array<React.ReactNode> | ||
} | ||
|
||
function AppCard(props: Props) { | ||
return ( | ||
<div className={styles.appCard} key={props.id}> | ||
<div className={styles.appCard_header}> | ||
<Badge | ||
dot | ||
color={props.status === 1 ? 'transparent' : props.status === 4 ? 'orange' : 'red'} | ||
> | ||
<div className={styles.appCard_icon}> | ||
{props.avatar && <img src={props.avatar} alt="" />} | ||
</div> | ||
</Badge> | ||
<div className={styles.appCard_text}> | ||
<p>{props.title}</p> | ||
<span>{props.message}</span> | ||
</div> | ||
</div> | ||
<p className={styles.appCard_description}>{props.description}</p> | ||
<div className={styles.appCard_footer}> | ||
<div className={styles.appCard_footer_userInfo}> | ||
{props.userInfo?.avatar && <img src={props.userInfo?.avatar} alt="" />} | ||
<span>{getEmailPre(props.userInfo?.account)}</span> | ||
</div> | ||
<div className={styles.appCard_button}>{props.buttons.map((dom) => dom)}</div> | ||
</div> | ||
</div> | ||
) | ||
} | ||
|
||
export default AppCard |
Oops, something went wrong.