-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4416 from janhq/chore/enhance-cortex-settings-page
enhancement: Update Cortex page with better description & UX
- Loading branch information
Showing
5 changed files
with
139 additions
and
30 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
50 changes: 50 additions & 0 deletions
50
web/screens/Settings/SettingDetail/SettingDetailItem/SettingDetailDropdownItem/index.tsx
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,50 @@ | ||
import { DropdownComponentProps, SettingComponentProps } from '@janhq/core' | ||
import { Select } from '@janhq/joi' | ||
import { Marked, Renderer } from 'marked' | ||
|
||
type Props = { | ||
settingProps: SettingComponentProps | ||
onValueChanged?: (e: string) => void | ||
} | ||
|
||
const marked: Marked = new Marked({ | ||
renderer: { | ||
link: (href, title, text) => { | ||
return Renderer.prototype.link | ||
?.apply(this, [href, title, text]) | ||
.replace( | ||
'<a', | ||
"<a class='text-[hsla(var(--app-link))]' target='_blank'" | ||
) | ||
}, | ||
}, | ||
}) | ||
|
||
const SettingDetailDropdownItem: React.FC<Props> = ({ | ||
settingProps, | ||
onValueChanged, | ||
}) => { | ||
const { value, options } = | ||
settingProps.controllerProps as DropdownComponentProps | ||
|
||
const description = marked.parse(settingProps.description ?? '', { | ||
async: false, | ||
}) | ||
|
||
return ( | ||
<div className="flex w-full justify-between py-6"> | ||
<div className="flex flex-1 flex-col space-y-1"> | ||
<h1 className="font-semibold">{settingProps.title}</h1> | ||
{ | ||
<div | ||
dangerouslySetInnerHTML={{ __html: description }} | ||
className="font-medium leading-relaxed text-[hsla(var(--text-secondary))]" | ||
/> | ||
} | ||
</div> | ||
<Select value={value} onValueChange={onValueChanged} options={options} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default SettingDetailDropdownItem |
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