Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format code with Prettier and StandardJS #483

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/components/stateless/ReMarkdown/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const PreCode = (props) => {
<span className={styles.lang}>{langRef.current}</span>
<span
className={styles.copySpan}
role="button"
role='button'
onClick={() => {
if (ref.current) {
const code = ref.current.innerText
Expand Down Expand Up @@ -94,19 +94,19 @@ const ReMarkdown = ({ markdownText = '', isLoading = false }) => (
RehypeHighlight,
{
detect: false,
ignoreMissing: true,
},
],
ignoreMissing: true
}
]
]}
components={{
pre: PreCode,
p: (pProps) => <p {...pProps} dir="auto" />,
p: (pProps) => <p {...pProps} dir='auto' />,
a: (aProps) => {
const href = aProps.href || ''
const isInternal = /^\/#/i.test(href)
const target = isInternal ? '_self' : (aProps.target ?? '_blank')
const target = isInternal ? '_self' : aProps.target ?? '_blank'
return <a {...aProps} target={target} />
},
}
}}
>
{markdownText}
Expand Down
7 changes: 4 additions & 3 deletions src/components/stateless/StarRating/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from './index.module.less'

const Star = ({ marked, starId }) => {
return (
<span data-star-id={starId} className={styles.star} role="button">
<span data-star-id={starId} className={styles.star} role='button'>
{marked ? '\u2605' : '\u2606'}
</span>
)
Expand All @@ -15,16 +15,17 @@ const StarRating = ({ value }) => {

const hoverOver = (event) => {
let val = 0
if (event && event.target && event.target.getAttribute('data-star-id'))
if (event && event.target && event.target.getAttribute('data-star-id')) {
val = event.target.getAttribute('data-star-id')
}
setSelection(val)
}
return (
<div
onMouseOut={() => hoverOver(null)}
onClick={(e) => setRating(e.target.getAttribute('data-star-id') || rating)}
onMouseOver={hoverOver}
role="button"
role='button'
>
{Array.from({ length: 5 }, (v, i) => (
<Star starId={i + 1} key={`star_${i + 1}`} marked={selection ? selection >= i + 1 : rating >= i + 1} />
Expand Down
16 changes: 9 additions & 7 deletions src/pages/layout/proSider/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,21 @@ const ProSider = ({ children }) => {
<Layout.Sider
width={208}
collapsedWidth={80}
theme="light"
theme='light'
collapsible
collapsed={collapsed}
trigger={null}
className={styles.sider}
>
{children}
<div className={styles.proLink} onClick={onCollapse} role="button">
{collapsed ? (
<MenuUnfoldOutlined style={{ fontSize: '16px', color: '#08c', cursor: 'pointer' }} />
) : (
<MenuFoldOutlined style={{ fontSize: '18px', color: '#08c', cursor: 'pointer' }} />
)}
<div className={styles.proLink} onClick={onCollapse} role='button'>
{collapsed
? (
<MenuUnfoldOutlined style={{ fontSize: '16px', color: '#08c', cursor: 'pointer' }} />
)
: (
<MenuFoldOutlined style={{ fontSize: '18px', color: '#08c', cursor: 'pointer' }} />
)}
</div>
</Layout.Sider>
)
Expand Down
18 changes: 9 additions & 9 deletions src/utils/aidFn.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const getImgsUrl = (html) => {
export const customizeTimer = {
intervalTimer: null,
timeoutTimer: null,
setTimeout(cb, interval) {
setTimeout (cb, interval) {
const { now } = Date
const stime = now()
let etime = stime
Expand All @@ -78,10 +78,10 @@ export const customizeTimer = {
this.timeoutTimer = requestAnimationFrame(loop)
return this.timeoutTimer
},
clearTimeout() {
clearTimeout () {
cancelAnimationFrame(this.timeoutTimer)
},
setInterval(cb, interval) {
setInterval (cb, interval) {
const { now } = Date
let stime = now()
let etime = stime
Expand All @@ -97,9 +97,9 @@ export const customizeTimer = {
this.intervalTimer = requestAnimationFrame(loop)
return this.intervalTimer
},
clearInterval() {
clearInterval () {
cancelAnimationFrame(this.intervalTimer)
},
}
}

export const isDecimal = (value) => {
Expand Down Expand Up @@ -249,13 +249,13 @@ export const oneApiChat = (chatList, token, signal) =>
signal,
headers: {
Authorization: token,
'Content-Type': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'gpt-3.5-turbo',
messages: chatList,
stream: true,
}),
stream: true
})
})

export const getCurrentDate = () => {
Expand Down Expand Up @@ -283,7 +283,7 @@ export const saveHtmlToPng = async (eleHtml, successFun, errorFun) => {
try {
const ele = eleHtml ?? document.getElementById('image-wrapper')
const canvas = await html2canvas(ele, {
useCORS: true,
useCORS: true
})
const imgUrl = canvas.toDataURL('image/png')
const tempLink = document.createElement('a')
Expand Down
Loading