Estimate History management added

This commit is contained in:
2026-03-13 14:41:46 -05:00
parent c090c18734
commit e637e0903d
6 changed files with 256 additions and 13 deletions
@@ -1,5 +1,6 @@
import { Show } from 'solid-js';
import type { Component } from 'solid-js';
import { PanelLeftOpen, PanelLeftClose, Calculator, Plus, FileUp, Upload, Table, Download } from 'lucide-solid';
import { PanelLeftOpen, PanelLeftClose, Calculator, Plus, FileUp, Upload, Table, Download, History, Save } from 'lucide-solid';
import { appStore } from '../../store/appStore';
interface BuilderHeaderProps {
@@ -12,6 +13,8 @@ interface BuilderHeaderProps {
onExportEstimate: () => void;
onShowLoadModal: () => void;
onShowSaveModal: () => void;
onShowHistoryModal: () => void;
onSaveChanges: () => void;
}
export const BuilderHeader: Component<BuilderHeaderProps> = (props) => {
@@ -78,11 +81,29 @@ export const BuilderHeader: Component<BuilderHeaderProps> = (props) => {
>
<Download class="w-4 h-4" /> Load
</button>
<Show when={appStore.estimateId()}>
<button
onClick={props.onShowHistoryModal}
class="flex items-center gap-2 px-3 py-2 bg-purple-50 text-purple-600 rounded-xl text-xs font-bold hover:bg-purple-100 transition-all border border-purple-200"
>
<History class="w-4 h-4" /> History
</button>
<button
onClick={props.onSaveChanges}
class="flex items-center gap-2 px-3 py-2 bg-green-50 text-green-600 rounded-xl text-xs font-bold hover:bg-green-100 transition-all border border-green-200"
>
<Save class="w-4 h-4" />
{appStore.isLatestVersion() ? 'Save Changes' : 'Save as Newest'}
</button>
</Show>
<button
onClick={props.onShowSaveModal}
class="flex items-center gap-2 px-4 py-2 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:bg-primary/90 transition-all shadow-lg shadow-primary/10"
class="flex items-center gap-4 py-2 px-4 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:bg-primary/90 transition-all shadow-lg shadow-primary/10"
>
<Upload class="w-4 h-4" /> Save
<Upload class="w-4 h-4" /> Save New
</button>
</div>
</div>