Skip to content

Commit 4002dbc

Browse files
committed
Disable apply button when target is API and update shared import
- always show 'Apply' button in the footer, but keep it disabled in API target ├── apps │ └── editor │ └── src │ └── views │ └── prompt │ └── frontend │ ├── Prompt.tsx │ ├── components │ │ └── Layout │ │ ├── Footer │ │ │ ├── Footer.module.scss │ │ │ ├── Footer.tsx │ │ │ └── index.ts │ │ └── Layout.tsx │ └── contexts │ └── LayoutContext.tsx └── packages ├── shared │ └── src │ ├── hooks │ │ ├── index.ts │ │ └── use-compacting.ts │ └── types │ └── target.ts └── ui └── src └── components └── editor └── prompt-view └── CompactableActionButton ├── CompactableActionButton.module.scss ├── CompactableActionButton.tsx └── index.ts
1 parent b0c205f commit 4002dbc

2 files changed

Lines changed: 10 additions & 15 deletions

File tree

‎apps/editor/scripts/package.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { create_zip } from '../../../packages/shared/src/utils/create-zip/create-zip.ts'
1+
import { create_zip } from '@shared/utils/create-zip'
22
import * as fs from 'node:fs'
33
import * as path from 'node:path'
44
import { fileURLToPath } from 'node:url'

‎apps/editor/src/views/prompt/frontend/components/Layout/Footer/Footer.tsx‎

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useContext, useEffect } from 'react'
1+
import { useContext } from 'react'
22
import styles from './Footer.module.scss'
33
import { use_compacting } from '@shared/hooks'
44
import { LayoutContext } from '../../../contexts/LayoutContext'
@@ -24,11 +24,7 @@ export const Footer: React.FC<Props> = (props) => {
2424
on_commit_click
2525
} = useContext(LayoutContext)
2626
const { t } = use_translation()
27-
const { container_ref, compact_step, reset_compacting } = use_compacting()
28-
29-
useEffect(() => {
30-
reset_compacting()
31-
}, [target, reset_compacting])
27+
const { container_ref, compact_step } = use_compacting()
3228

3329
const {
3430
is_alt,
@@ -101,14 +97,13 @@ export const Footer: React.FC<Props> = (props) => {
10197
codicon="git-pull-request-comment"
10298
label={t('footer.action.commit')}
10399
/>
104-
{target !== 'API' && (
105-
<CompactableActionButton
106-
is_compact={compact_step >= 4}
107-
on_click={on_apply_click}
108-
codicon="sparkle"
109-
label={t('footer.action.apply')}
110-
/>
111-
)}
100+
<CompactableActionButton
101+
is_compact={compact_step >= 4}
102+
on_click={on_apply_click}
103+
disabled={target === 'API'}
104+
codicon="sparkle"
105+
label={t('footer.action.apply')}
106+
/>
112107
</div>
113108
{props.is_home_active && (
114109
<span className={styles['footer__happy-coding']}>

0 commit comments

Comments
 (0)