Enhance form styling and add Markdown help toggle in recipe creation and editing pages. Enhance form and styling on other pages aswell.
This commit is contained in:
@@ -34,15 +34,43 @@ export default function CanonicalNameForm({
|
|||||||
}}
|
}}
|
||||||
style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexWrap: 'wrap' }}
|
style={{ display: 'flex', gap: '0.5rem', alignItems: 'center', flexWrap: 'wrap' }}
|
||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={id} />
|
<input
|
||||||
|
type="hidden"
|
||||||
|
name="id"
|
||||||
|
value={id}
|
||||||
|
/>
|
||||||
<input
|
<input
|
||||||
name="canonicalName"
|
name="canonicalName"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={currentCanonicalName || ''}
|
defaultValue={currentCanonicalName || ''}
|
||||||
placeholder="Canonical name"
|
placeholder="Canonical name"
|
||||||
style={{ padding: '0.4rem', minWidth: '220px' }}
|
style={{
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
minWidth: '220px',
|
||||||
|
flex: '1 1 200px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<button type="submit" disabled={isPending} style={{ padding: '0.4rem 0.75rem' }}>
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={isPending}
|
||||||
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#0070f3',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
whiteSpace: 'nowrap',
|
||||||
|
}}
|
||||||
|
>
|
||||||
{isPending ? 'Sparar...' : 'Spara'}
|
{isPending ? 'Sparar...' : 'Spara'}
|
||||||
</button>
|
</button>
|
||||||
{error ? <span style={{ color: 'crimson' }}>{error}</span> : null}
|
{error ? <span style={{ color: 'crimson' }}>{error}</span> : null}
|
||||||
|
|||||||
@@ -99,14 +99,21 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
>
|
>
|
||||||
<h2 style={{ margin: 0 }}>Förhandsgranska merge</h2>
|
<h2 style={{ margin: 0 }}>Förhandsgranska merge</h2>
|
||||||
|
|
||||||
<div style={{ display: 'grid', gap: '0.75rem', gridTemplateColumns: '1fr 1fr' }}>
|
<div style={{ display: 'grid', gap: '0.75rem', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))' }}>
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Source product (ska bort)
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Source product (ska bort)</span>
|
||||||
<br />
|
|
||||||
<select
|
<select
|
||||||
value={sourceProductId}
|
value={sourceProductId}
|
||||||
onChange={(e) => setSourceProductId(e.target.value)}
|
onChange={(e) => setSourceProductId(e.target.value)}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value="">Välj source</option>
|
<option value="">Välj source</option>
|
||||||
{products.map((product) => (
|
{products.map((product) => (
|
||||||
@@ -117,13 +124,20 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Target product (ska behållas)
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Target product (ska behållas)</span>
|
||||||
<br />
|
|
||||||
<select
|
<select
|
||||||
value={targetProductId}
|
value={targetProductId}
|
||||||
onChange={(e) => setTargetProductId(e.target.value)}
|
onChange={(e) => setTargetProductId(e.target.value)}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<option value="">Välj target</option>
|
<option value="">Välj target</option>
|
||||||
{products.map((product) => (
|
{products.map((product) => (
|
||||||
@@ -140,7 +154,17 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={fetchPreview}
|
onClick={fetchPreview}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 1rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#0070f3',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isPending ? 'Hämtar preview...' : 'Förhandsgranska merge'}
|
{isPending ? 'Hämtar preview...' : 'Förhandsgranska merge'}
|
||||||
</button>
|
</button>
|
||||||
@@ -150,7 +174,17 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsConfirming((prev) => !prev)}
|
onClick={() => setIsConfirming((prev) => !prev)}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 1rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#f0f0f0',
|
||||||
|
color: '#333',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isConfirming ? 'Avbryt bekräftelse' : 'Gå vidare till bekräftelse'}
|
{isConfirming ? 'Avbryt bekräftelse' : 'Gå vidare till bekräftelse'}
|
||||||
</button>
|
</button>
|
||||||
@@ -239,7 +273,17 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={confirmMerge}
|
onClick={confirmMerge}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.75rem 1rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#c0392b',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isPending ? 'Slår ihop...' : 'Bekräfta merge'}
|
{isPending ? 'Slår ihop...' : 'Bekräfta merge'}
|
||||||
</button>
|
</button>
|
||||||
@@ -248,7 +292,17 @@ export default function MergePreviewForm({ products }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsConfirming(false)}
|
onClick={() => setIsConfirming(false)}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.75rem 1rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#f0f0f0',
|
||||||
|
color: '#333',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Avbryt
|
Avbryt
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -64,25 +64,39 @@ export default function InventoryConsumeForm({ id, unit }: Props) {
|
|||||||
>
|
>
|
||||||
<input type="hidden" name="id" value={id} />
|
<input type="hidden" name="id" value={id} />
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Hur mycket använde du? ({unit})
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Hur mycket använde du? ({unit})</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="amountUsed"
|
name="amountUsed"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Kommentar
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Kommentar</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="comment"
|
name="comment"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="t.ex. lagade middag"
|
placeholder="t.ex. lagade middag"
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -90,7 +104,17 @@ export default function InventoryConsumeForm({ id, unit }: Props) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 0.9rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#0070f3',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isPending ? 'Sparar...' : 'Spara användning'}
|
{isPending ? 'Sparar...' : 'Spara användning'}
|
||||||
</button>
|
</button>
|
||||||
@@ -99,7 +123,17 @@ export default function InventoryConsumeForm({ id, unit }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsOpen(false)}
|
onClick={() => setIsOpen(false)}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 0.9rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#f0f0f0',
|
||||||
|
color: '#333',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Avbryt
|
Avbryt
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -120,25 +120,39 @@ export default function InventoryEditForm({ item }: Props) {
|
|||||||
gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))',
|
gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Mängd
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Mängd</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="quantity"
|
name="quantity"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
defaultValue={item.quantity}
|
defaultValue={item.quantity}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Enhet
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Enhet</span>
|
||||||
<br />
|
|
||||||
<select
|
<select
|
||||||
name="unit"
|
name="unit"
|
||||||
defaultValue={item.unit}
|
defaultValue={item.unit}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{UNIT_OPTIONS.map((opt) => (
|
{UNIT_OPTIONS.map((opt) => (
|
||||||
<option key={opt.value} value={opt.value}>
|
<option key={opt.value} value={opt.value}>
|
||||||
@@ -148,13 +162,20 @@ export default function InventoryEditForm({ item }: Props) {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Plats
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Plats</span>
|
||||||
<br />
|
|
||||||
<select
|
<select
|
||||||
name="location"
|
name="location"
|
||||||
defaultValue={item.location || ''}
|
defaultValue={item.location || ''}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{LOCATION_OPTIONS.map((opt) => (
|
{LOCATION_OPTIONS.map((opt) => (
|
||||||
<option key={opt.value} value={opt.value}>
|
<option key={opt.value} value={opt.value}>
|
||||||
@@ -164,48 +185,76 @@ export default function InventoryEditForm({ item }: Props) {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Varumärke
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Varumärke</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="brand"
|
name="brand"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={item.brand || ''}
|
defaultValue={item.brand || ''}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Bäst före
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Bäst före</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="bestBeforeDate"
|
name="bestBeforeDate"
|
||||||
type="date"
|
type="date"
|
||||||
defaultValue={toDateInputValue(item.bestBeforeDate)}
|
defaultValue={toDateInputValue(item.bestBeforeDate)}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Passar till
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Passar till</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="suitableFor"
|
name="suitableFor"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={item.suitableFor || ''}
|
defaultValue={item.suitableFor || ''}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'grid', gap: '0.3rem' }}>
|
||||||
Kommentar
|
<span style={{ fontWeight: 500, fontSize: '0.9rem' }}>Kommentar</span>
|
||||||
<br />
|
|
||||||
<input
|
<input
|
||||||
name="comment"
|
name="comment"
|
||||||
type="text"
|
type="text"
|
||||||
defaultValue={item.comment || ''}
|
defaultValue={item.comment || ''}
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -222,7 +271,17 @@ export default function InventoryEditForm({ item }: Props) {
|
|||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 0.9rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#0070f3',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{isPending ? 'Sparar...' : 'Spara ändringar'}
|
{isPending ? 'Sparar...' : 'Spara ändringar'}
|
||||||
</button>
|
</button>
|
||||||
@@ -231,7 +290,17 @@ export default function InventoryEditForm({ item }: Props) {
|
|||||||
type="button"
|
type="button"
|
||||||
onClick={() => setIsEditing(false)}
|
onClick={() => setIsEditing(false)}
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
style={{ padding: '0.6rem 0.9rem' }}
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#f0f0f0',
|
||||||
|
color: '#333',
|
||||||
|
border: '1px solid #ccc',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Avbryt
|
Avbryt
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -36,19 +36,40 @@ export default function ProductForm() {
|
|||||||
>
|
>
|
||||||
<h2 style={{ margin: 0 }}>Skapa produkt</h2>
|
<h2 style={{ margin: 0 }}>Skapa produkt</h2>
|
||||||
|
|
||||||
<label>
|
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
|
||||||
Produktnamn
|
Produktnamn
|
||||||
<br />
|
</label>
|
||||||
<input
|
<input
|
||||||
name="name"
|
name="name"
|
||||||
type="text"
|
type="text"
|
||||||
required
|
required
|
||||||
placeholder="Till exempel Rödkål"
|
placeholder="Till exempel Rödkål"
|
||||||
style={{ width: '100%', padding: '0.5rem' }}
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
padding: '0.75rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
fontSize: '1rem',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
minHeight: '44px',
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</label>
|
|
||||||
|
|
||||||
<button type="submit" disabled={isPending} style={{ padding: '0.75rem' }}>
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={isPending}
|
||||||
|
style={{
|
||||||
|
padding: '0.75rem 1.5rem',
|
||||||
|
background: '#0070f3',
|
||||||
|
color: 'white',
|
||||||
|
border: 'none',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '1rem',
|
||||||
|
minHeight: '44px',
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
|
>
|
||||||
{isPending ? 'Sparar...' : 'Skapa produkt'}
|
{isPending ? 'Sparar...' : 'Skapa produkt'}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export default function EditRecipePage() {
|
|||||||
const [isDeleting, setIsDeleting] = useState(false);
|
const [isDeleting, setIsDeleting] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [showPreview, setShowPreview] = useState(false);
|
const [showPreview, setShowPreview] = useState(false);
|
||||||
|
const [showMarkdownHelp, setShowMarkdownHelp] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const loadData = async () => {
|
const loadData = async () => {
|
||||||
@@ -205,6 +206,7 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -225,6 +227,7 @@ export default function EditRecipePage() {
|
|||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '100px',
|
minHeight: '100px',
|
||||||
fontFamily: 'inherit',
|
fontFamily: 'inherit',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -233,10 +236,32 @@ export default function EditRecipePage() {
|
|||||||
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
|
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
|
||||||
Instruktioner
|
Instruktioner
|
||||||
</label>
|
</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowMarkdownHelp(!showMarkdownHelp)}
|
||||||
|
style={{
|
||||||
|
marginBottom: '0.5rem',
|
||||||
|
padding: '0.4rem 0.75rem',
|
||||||
|
background: '#f9f9f9',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '0.85rem',
|
||||||
|
color: '#666',
|
||||||
|
fontWeight: 500,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '0.25rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span>{showMarkdownHelp ? '▼' : '▶'}</span>
|
||||||
|
<strong>Markdown-stöd</strong>
|
||||||
|
</button>
|
||||||
|
{showMarkdownHelp && (
|
||||||
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
|
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
|
||||||
<strong>Markdown-stöd:</strong>
|
|
||||||
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
|
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
value={recipe.instructions}
|
value={recipe.instructions}
|
||||||
@@ -249,7 +274,8 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '150px',
|
minHeight: '150px',
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'inherit',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -313,6 +339,8 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<option value={0}>Välj produkt</option>
|
<option value={0}>Välj produkt</option>
|
||||||
@@ -335,6 +363,8 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -348,6 +378,8 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{UNIT_OPTIONS.map((opt) => (
|
{UNIT_OPTIONS.map((opt) => (
|
||||||
@@ -368,6 +400,8 @@ export default function EditRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ export default function CreateRecipePage() {
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [showPreview, setShowPreview] = useState(false);
|
const [showPreview, setShowPreview] = useState(false);
|
||||||
|
const [showMarkdownHelp, setShowMarkdownHelp] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchJson<Product[]>('/api/products')
|
fetchJson<Product[]>('/api/products')
|
||||||
@@ -160,6 +161,7 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -180,6 +182,7 @@ export default function CreateRecipePage() {
|
|||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '100px',
|
minHeight: '100px',
|
||||||
fontFamily: 'inherit',
|
fontFamily: 'inherit',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -188,10 +191,32 @@ export default function CreateRecipePage() {
|
|||||||
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
|
<label style={{ display: 'block', marginBottom: '0.5rem', fontWeight: 600 }}>
|
||||||
Instruktioner
|
Instruktioner
|
||||||
</label>
|
</label>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setShowMarkdownHelp(!showMarkdownHelp)}
|
||||||
|
style={{
|
||||||
|
marginBottom: '0.5rem',
|
||||||
|
padding: '0.4rem 0.75rem',
|
||||||
|
background: '#f9f9f9',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
cursor: 'pointer',
|
||||||
|
fontSize: '0.85rem',
|
||||||
|
color: '#666',
|
||||||
|
fontWeight: 500,
|
||||||
|
display: 'flex',
|
||||||
|
alignItems: 'center',
|
||||||
|
gap: '0.25rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span>{showMarkdownHelp ? '▼' : '▶'}</span>
|
||||||
|
<strong>Markdown-stöd</strong>
|
||||||
|
</button>
|
||||||
|
{showMarkdownHelp && (
|
||||||
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
|
<div style={{ marginBottom: '0.5rem', fontSize: '0.85rem', background: '#f9f9f9', padding: '0.5rem', borderRadius: '4px', color: '#666' }}>
|
||||||
<strong>Markdown-stöd:</strong>
|
|
||||||
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
|
<div style={{ whiteSpace: 'pre-wrap', marginTop: '0.25rem' }}>{MARKDOWN_HELP}</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
value={recipe.instructions}
|
value={recipe.instructions}
|
||||||
@@ -204,7 +229,8 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '150px',
|
minHeight: '150px',
|
||||||
fontFamily: 'monospace',
|
fontFamily: 'inherit',
|
||||||
|
boxSizing: 'border-box',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -268,6 +294,8 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<option value={0}>Välj produkt</option>
|
<option value={0}>Välj produkt</option>
|
||||||
@@ -290,6 +318,8 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -303,6 +333,8 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{UNIT_OPTIONS.map((opt) => (
|
{UNIT_OPTIONS.map((opt) => (
|
||||||
@@ -323,6 +355,8 @@ export default function CreateRecipePage() {
|
|||||||
borderRadius: '4px',
|
borderRadius: '4px',
|
||||||
fontSize: '1rem',
|
fontSize: '1rem',
|
||||||
minHeight: '44px',
|
minHeight: '44px',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user