mirror of
https://github.com/pionxzh/chatgpt-exporter.git
synced 2026-07-23 09:00:51 -05:00
fix: add scrolling to settings dialog
This commit is contained in:
@@ -46,6 +46,13 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.DialogBody {
|
||||||
|
flex: 1;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.dark .DialogTitle {
|
.dark .DialogTitle {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,219 +64,220 @@ export const SettingDialog: FC<SettingDialogProps> = ({
|
|||||||
<Dialog.Overlay className="DialogOverlay" />
|
<Dialog.Overlay className="DialogOverlay" />
|
||||||
<Dialog.Content className="DialogContent">
|
<Dialog.Content className="DialogContent">
|
||||||
<Dialog.Title className="DialogTitle">{t('Exporter Settings')}</Dialog.Title>
|
<Dialog.Title className="DialogTitle">{t('Exporter Settings')}</Dialog.Title>
|
||||||
|
<div className="DialogBody">
|
||||||
<dl className="space-y-6">
|
<dl className="space-y-6">
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
<div>
|
<div>
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
{`${t('Language')} 🌐`}
|
{`${t('Language')} 🌐`}
|
||||||
</dt>
|
</dt>
|
||||||
<dd>
|
<dd>
|
||||||
<select
|
<select
|
||||||
className="Select mt-3"
|
className="Select mt-3"
|
||||||
value={i18n.language}
|
value={i18n.language}
|
||||||
onChange={e => i18n.changeLanguage(e.currentTarget.value)}
|
onChange={e => i18n.changeLanguage(e.currentTarget.value)}
|
||||||
>
|
>
|
||||||
{LOCALES.map(({ name, code }) => (
|
{LOCALES.map(({ name, code }) => (
|
||||||
<option key={code} value={code}>{name}</option>
|
<option key={code} value={code}>{name}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</dd>
|
</dd>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
<div>
|
||||||
<div>
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
{t('File Name')}
|
||||||
{t('File Name')}
|
</dt>
|
||||||
</dt>
|
<dd>
|
||||||
<dd>
|
<p className="text-sm text-gray-700 dark:text-gray-300">
|
||||||
<p className="text-sm text-gray-700 dark:text-gray-300">
|
{t('Available variables')}:{' '}
|
||||||
{t('Available variables')}:{' '}
|
<Variable name="{title}" title={title} />
|
||||||
<Variable name="{title}" title={title} />
|
,{' '}
|
||||||
,{' '}
|
<Variable name="{date}" title={date} />
|
||||||
<Variable name="{date}" title={date} />
|
,{' '}
|
||||||
,{' '}
|
<Variable name="{timestamp}" title={timestamp} />
|
||||||
<Variable name="{timestamp}" title={timestamp} />
|
,{' '}
|
||||||
,{' '}
|
<Variable name="{chat_id}" title={chatId} />
|
||||||
<Variable name="{chat_id}" title={chatId} />
|
,{' '}
|
||||||
,{' '}
|
<Variable name="{create_time}" title={unixTimestampToISOString(createTime)} />
|
||||||
<Variable name="{create_time}" title={unixTimestampToISOString(createTime)} />
|
,{' '}
|
||||||
,{' '}
|
<Variable name="{update_time}" title={unixTimestampToISOString(updateTime)} />
|
||||||
<Variable name="{update_time}" title={unixTimestampToISOString(updateTime)} />
|
</p>
|
||||||
</p>
|
<input className="Input mt-4" id="filename" value={format} onChange={e => setFormat(e.currentTarget.value)} />
|
||||||
<input className="Input mt-4" id="filename" value={format} onChange={e => setFormat(e.currentTarget.value)} />
|
<p className="mt-1 text-sm text-gray-700 dark:text-gray-300">
|
||||||
<p className="mt-1 text-sm text-gray-700 dark:text-gray-300">
|
{t('Preview')}:{' '}
|
||||||
{t('Preview')}:{' '}
|
<span className="select-all" style={{ 'text-decoration': 'underline', 'text-underline-offset': 4 }}>{preview}</span>
|
||||||
<span className="select-all" style={{ 'text-decoration': 'underline', 'text-underline-offset': 4 }}>{preview}</span>
|
</p>
|
||||||
</p>
|
</dd>
|
||||||
</dd>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
<div>
|
||||||
<div>
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
{t('Export Thinking Process')}
|
||||||
{t('Export Thinking Process')}
|
</dt>
|
||||||
</dt>
|
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
||||||
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
{t('Export Thinking Process Description')}
|
||||||
{t('Export Thinking Process Description')}
|
</dd>
|
||||||
</dd>
|
</div>
|
||||||
|
<div className="absolute right-4">
|
||||||
|
<Toggle label="" checked={enableThinking} onCheckedUpdate={setEnableThinking} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="absolute right-4">
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
<Toggle label="" checked={enableThinking} onCheckedUpdate={setEnableThinking} />
|
<div>
|
||||||
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
|
{t('Export All Limit')}{' '}
|
||||||
|
{/* Add translation key */}
|
||||||
|
</dt>
|
||||||
|
<dd className="text-sm text-gray-700 dark:text-gray-300 mt-2">
|
||||||
|
{t('Export All Limit Description')}{' '}
|
||||||
|
{/* Add translation key */}
|
||||||
|
<div className="flex items-center gap-4 mt-3">
|
||||||
|
<input
|
||||||
|
type="range"
|
||||||
|
min="100" // Set min value
|
||||||
|
max="20000" // Set max value (adjust as needed)
|
||||||
|
step="100" // Set step value
|
||||||
|
value={exportAllLimit}
|
||||||
|
onChange={e =>
|
||||||
|
setExportAllLimit(
|
||||||
|
Number.parseInt(
|
||||||
|
e.currentTarget.value,
|
||||||
|
10,
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
className="flex-grow h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
|
||||||
|
id="exportAllLimitSlider"
|
||||||
|
/>
|
||||||
|
<span className="font-medium text-gray-900 dark:text-gray-300 w-12 text-right">
|
||||||
|
{exportAllLimit}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
<div>
|
||||||
<div>
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
{t('Conversation Timestamp')}
|
||||||
{t('Export All Limit')}{' '}
|
</dt>
|
||||||
{/* Add translation key */}
|
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
||||||
</dt>
|
{t('Conversation Timestamp Description')}
|
||||||
<dd className="text-sm text-gray-700 dark:text-gray-300 mt-2">
|
{enableTimestamp && (
|
||||||
{t('Export All Limit Description')}{' '}
|
<>
|
||||||
{/* Add translation key */}
|
<div className="mt-2">
|
||||||
<div className="flex items-center gap-4 mt-3">
|
<Toggle
|
||||||
<input
|
label={t('Use 24-hour format')}
|
||||||
type="range"
|
checked={timeStamp24H}
|
||||||
min="100" // Set min value
|
onCheckedUpdate={setTimeStamp24H}
|
||||||
max="20000" // Set max value (adjust as needed)
|
|
||||||
step="100" // Set step value
|
|
||||||
value={exportAllLimit}
|
|
||||||
onChange={e =>
|
|
||||||
setExportAllLimit(
|
|
||||||
Number.parseInt(
|
|
||||||
e.currentTarget.value,
|
|
||||||
10,
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
className="flex-grow h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"
|
|
||||||
id="exportAllLimitSlider"
|
|
||||||
/>
|
|
||||||
<span className="font-medium text-gray-900 dark:text-gray-300 w-12 text-right">
|
|
||||||
{exportAllLimit}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
|
||||||
<div>
|
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
|
||||||
{t('Conversation Timestamp')}
|
|
||||||
</dt>
|
|
||||||
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
|
||||||
{t('Conversation Timestamp Description')}
|
|
||||||
{enableTimestamp && (
|
|
||||||
<>
|
|
||||||
<div className="mt-2">
|
|
||||||
<Toggle
|
|
||||||
label={t('Use 24-hour format')}
|
|
||||||
checked={timeStamp24H}
|
|
||||||
onCheckedUpdate={setTimeStamp24H}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="mt-2">
|
|
||||||
<Toggle
|
|
||||||
label={t('Enable on HTML')}
|
|
||||||
checked={enableTimestampHTML}
|
|
||||||
onCheckedUpdate={setEnableTimestampHTML}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className="mt-2">
|
|
||||||
<Toggle
|
|
||||||
label={t('Enable on Markdown')}
|
|
||||||
checked={enableTimestampMarkdown}
|
|
||||||
onCheckedUpdate={setEnableTimestampMarkdown}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="absolute right-4">
|
|
||||||
<Toggle label="" checked={enableTimestamp} onCheckedUpdate={setEnableTimestamp} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
|
||||||
<div>
|
|
||||||
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
|
||||||
{t('Export Metadata')}
|
|
||||||
</dt>
|
|
||||||
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
|
||||||
{t('Export Metadata Description')}
|
|
||||||
|
|
||||||
{enableMeta && (
|
|
||||||
<>
|
|
||||||
<p className="mt-2 text-sm text-gray-700 dark:text-gray-300">
|
|
||||||
{t('Available variables')}:{' '}
|
|
||||||
<Variable name="{title}" title={title} />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{date}" title={date} />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{timestamp}" title={timestamp} />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{source}" title={source} />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{model}" title="ChatGPT-3.5" />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{model_name}" title="text-davinci-002-render-sha" />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{create_time}" title="2023-04-10T21:45:35.027Z" />
|
|
||||||
,{' '}
|
|
||||||
<Variable name="{update_time}" title="2023-04-10T21:45:35.027Z" />
|
|
||||||
</p>
|
|
||||||
{/* eslint-disable-next-line pionxzh/consistent-list-newline */}
|
|
||||||
{exportMetaList.map((meta, i) => (
|
|
||||||
<div className="flex items-center mt-2" key={i}>
|
|
||||||
<input
|
|
||||||
className="Input"
|
|
||||||
value={meta.name}
|
|
||||||
onChange={(e) => {
|
|
||||||
const list = [...exportMetaList]
|
|
||||||
list[i] = { ...list[i], name: e.currentTarget.value }
|
|
||||||
setExportMetaList(list)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
<span className="mx-2">→</span>
|
</div>
|
||||||
<input
|
<div className="mt-2">
|
||||||
className="Input"
|
<Toggle
|
||||||
value={meta.value}
|
label={t('Enable on HTML')}
|
||||||
onChange={(e) => {
|
checked={enableTimestampHTML}
|
||||||
const list = [...exportMetaList]
|
onCheckedUpdate={setEnableTimestampHTML}
|
||||||
list[i] = { ...list[i], value: e.currentTarget.value }
|
|
||||||
setExportMetaList(list)
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="mt-2">
|
||||||
|
<Toggle
|
||||||
|
label={t('Enable on Markdown')}
|
||||||
|
checked={enableTimestampMarkdown}
|
||||||
|
onCheckedUpdate={setEnableTimestampMarkdown}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</dd>
|
||||||
|
</div>
|
||||||
|
<div className="absolute right-4">
|
||||||
|
<Toggle label="" checked={enableTimestamp} onCheckedUpdate={setEnableTimestamp} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="relative flex bg-white dark:bg-white/5 rounded p-4">
|
||||||
|
<div>
|
||||||
|
<dt className="text-md font-medium text-gray-800 dark:text-white">
|
||||||
|
{t('Export Metadata')}
|
||||||
|
</dt>
|
||||||
|
<dd className="text-sm text-gray-700 dark:text-gray-300">
|
||||||
|
{t('Export Metadata Description')}
|
||||||
|
|
||||||
|
{enableMeta && (
|
||||||
|
<>
|
||||||
|
<p className="mt-2 text-sm text-gray-700 dark:text-gray-300">
|
||||||
|
{t('Available variables')}:{' '}
|
||||||
|
<Variable name="{title}" title={title} />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{date}" title={date} />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{timestamp}" title={timestamp} />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{source}" title={source} />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{model}" title="ChatGPT-3.5" />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{model_name}" title="text-davinci-002-render-sha" />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{create_time}" title="2023-04-10T21:45:35.027Z" />
|
||||||
|
,{' '}
|
||||||
|
<Variable name="{update_time}" title="2023-04-10T21:45:35.027Z" />
|
||||||
|
</p>
|
||||||
|
{/* eslint-disable-next-line pionxzh/consistent-list-newline */}
|
||||||
|
{exportMetaList.map((meta, i) => (
|
||||||
|
<div className="flex items-center mt-2" key={i}>
|
||||||
|
<input
|
||||||
|
className="Input"
|
||||||
|
value={meta.name}
|
||||||
|
onChange={(e) => {
|
||||||
|
const list = [...exportMetaList]
|
||||||
|
list[i] = { ...list[i], name: e.currentTarget.value }
|
||||||
|
setExportMetaList(list)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<span className="mx-2">→</span>
|
||||||
|
<input
|
||||||
|
className="Input"
|
||||||
|
value={meta.value}
|
||||||
|
onChange={(e) => {
|
||||||
|
const list = [...exportMetaList]
|
||||||
|
list[i] = { ...list[i], value: e.currentTarget.value }
|
||||||
|
setExportMetaList(list)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
className="ml-2 rounded-full p-1 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition ease-in-out duration-150"
|
||||||
|
aria-label="Remove"
|
||||||
|
onClick={() => setExportMetaList(exportMetaList.filter((_, j) => j !== i))}
|
||||||
|
>
|
||||||
|
<IconTrash className="w-4 h-4" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
<div className="flex justify-center items-center mt-2 pr-8">
|
||||||
<button
|
<button
|
||||||
className="ml-2 rounded-full p-1 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition ease-in-out duration-150"
|
className="w-full border border-[#6f6e77] dark:border-gray-[#86858d] rounded-md py-2 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition ease-in-out duration-150"
|
||||||
aria-label="Remove"
|
aria-label="Add"
|
||||||
onClick={() => setExportMetaList(exportMetaList.filter((_, j) => j !== i))}
|
onClick={() => setExportMetaList([...exportMetaList, { name: '', value: '' }])}
|
||||||
>
|
>
|
||||||
<IconTrash className="w-4 h-4" />
|
+
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
))}
|
</>
|
||||||
<div className="flex justify-center items-center mt-2 pr-8">
|
)}
|
||||||
<button
|
</dd>
|
||||||
className="w-full border border-[#6f6e77] dark:border-gray-[#86858d] rounded-md py-2 text-sm font-medium text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700 transition ease-in-out duration-150"
|
</div>
|
||||||
aria-label="Add"
|
<div className="absolute right-4">
|
||||||
onClick={() => setExportMetaList([...exportMetaList, { name: '', value: '' }])}
|
<Toggle label="" checked={enableMeta} onCheckedUpdate={setEnableMeta} />
|
||||||
>
|
</div>
|
||||||
+
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div className="absolute right-4">
|
|
||||||
<Toggle label="" checked={enableMeta} onCheckedUpdate={setEnableMeta} />
|
|
||||||
</div>
|
</div>
|
||||||
|
</dl>
|
||||||
|
<div className="flex mt-6" style={{ justifyContent: 'flex-end' }}>
|
||||||
|
<Dialog.Close asChild>
|
||||||
|
<button className="Button green font-bold">{t('Save')}</button>
|
||||||
|
</Dialog.Close>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
|
||||||
<div className="flex mt-6" style={{ justifyContent: 'flex-end' }}>
|
|
||||||
<Dialog.Close asChild>
|
|
||||||
<button className="Button green font-bold">{t('Save')}</button>
|
|
||||||
</Dialog.Close>
|
|
||||||
</div>
|
</div>
|
||||||
<Dialog.Close asChild>
|
<Dialog.Close asChild>
|
||||||
<button className="IconButton CloseButton" aria-label="Close">
|
<button className="IconButton CloseButton" aria-label="Close">
|
||||||
|
|||||||
Reference in New Issue
Block a user