cleanup around manual prices

This commit is contained in:
2026-03-05 02:54:36 -05:00
parent d8386dccf4
commit c069060d8b
4 changed files with 21 additions and 36 deletions

View File

@@ -35,7 +35,7 @@ const vFocus = { mounted: (el: HTMLElement) => el.focus() }
const props = defineProps<{ itemId: string }>()
const { getPrice, isManualPrice, getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { getPrice, getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { filters } = useFilters()
const editing = ref(false)
@@ -46,25 +46,22 @@ const city = computed(() => filters.value.city)
const entry = computed(() => getPrice(props.itemId, city.value))
const currentPrice = computed(() => entry.value?.sell_price_min ?? 0)
const isManual = computed(() => isManualPrice(props.itemId, city.value))
const displayText = computed(() =>
currentPrice.value > 0 ? formatSilver(currentPrice.value) : '—'
)
const cellClass = computed(() => {
if (isManual.value) return 'text-amber-400 hover:text-amber-200'
if (currentPrice.value === 0) return 'text-gray-600 hover:text-amber-400'
return 'text-gray-300 hover:text-gray-100'
})
const cellClass = computed(() =>
currentPrice.value > 0 ? 'text-amber-400 hover:text-amber-200' : 'text-gray-600 hover:text-amber-400'
)
const tooltip = computed(() => {
const exact = currentPrice.value > 0 ? currentPrice.value.toLocaleString() : null
const e = getManualEntry(props.itemId, city.value)
if (e && isManual.value) {
return exact ? `${exact} — set ${formatLastUpdated(new Date(e.editedAt))} — click to edit` : `Set ${formatLastUpdated(new Date(e.editedAt))} — click to edit`
if (e) {
const exact = currentPrice.value.toLocaleString()
return `${exact} — set ${formatLastUpdated(new Date(e.editedAt))} — click to edit`
}
return exact ? `${exact} — click to edit` : 'Click to set price'
return 'Click to set price'
})
function startEdit(initial?: number) {

View File

@@ -263,7 +263,7 @@ const props = defineProps<{
result: ProfitResult
}>()
const { isManualPrice, getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { filters } = useFilters()
const { upsert, remove, getQty, inOrder } = useProductionOrder()
@@ -345,23 +345,16 @@ function ageDotTitle(result: ProfitResult): string {
// ─── Price cell helpers ───────────────────────────────────────────────────────
function priceButtonClass(itemId: string, currentPrice: number): string {
if (isManualPrice(itemId, filters.value.city)) {
return 'text-amber-400 hover:text-amber-200'
}
if (currentPrice === 0) {
return 'text-gray-500 hover:text-amber-400'
}
return 'text-gray-300 hover:text-gray-100'
function priceButtonClass(_itemId: string, currentPrice: number): string {
return currentPrice > 0 ? 'text-amber-400 hover:text-amber-200' : 'text-gray-500 hover:text-amber-400'
}
function priceTitle(itemId: string, currentPrice: number): string {
const exact = currentPrice > 0 ? currentPrice.toLocaleString() : null
const entry = getManualEntry(itemId, filters.value.city)
if (entry && isManualPrice(itemId, filters.value.city)) {
return exact ? `${exact} — set ${formatLastUpdated(new Date(entry.editedAt))}click to edit` : `Set ${formatLastUpdated(new Date(entry.editedAt))} — click to edit`
if (entry) {
return `${currentPrice.toLocaleString()}set ${formatLastUpdated(new Date(entry.editedAt))} — click to edit`
}
return exact ? `${exact} — click to set price` : 'Click to set price'
return 'Click to set price'
}
// ─── Edit state ───────────────────────────────────────────────────────────────

View File

@@ -6,7 +6,7 @@
<h2 class="text-lg font-semibold text-gray-200">Price Editor</h2>
<div class="h-5 w-px bg-gray-600" />
<span class="text-xs text-gray-500">
Amber = manual override · Click any price to edit · Empty field to clear override
Amber = price set · Click any price to edit · Leave empty to clear
</span>
</div>

View File

@@ -238,7 +238,7 @@ import type { Tier, JournalType } from '../types/crafting'
const vFocus = { mounted: (el: HTMLElement) => el.focus() }
const { orderItems, upsert, remove, clear } = useProductionOrder()
const { getPrice, isManualPrice, getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { getPrice, getManualEntry, setManualPrice, clearManualPrice } = useAlbionPrices()
const { filters } = useFilters()
// ─── Inline price editing ─────────────────────────────────────────────────────
@@ -267,21 +267,16 @@ function cancelEdit() {
inputValue.value = ''
}
function priceButtonClass(itemId: string, currentPrice: number): string {
if (isManualPrice(itemId, filters.value.city)) return 'text-amber-400 hover:text-amber-200'
if (currentPrice === 0) return 'text-gray-500 hover:text-amber-400'
return 'text-gray-300 hover:text-gray-100'
function priceButtonClass(_itemId: string, currentPrice: number): string {
return currentPrice > 0 ? 'text-amber-400 hover:text-amber-200' : 'text-gray-500 hover:text-amber-400'
}
function priceTitle(itemId: string, currentPrice: number): string {
const exact = currentPrice > 0 ? currentPrice.toLocaleString() : null
const entry = getManualEntry(itemId, filters.value.city)
if (entry && isManualPrice(itemId, filters.value.city)) {
return exact
? `${exact} — set ${formatLastUpdated(new Date(entry.editedAt))} — click to edit`
: `Set ${formatLastUpdated(new Date(entry.editedAt))} — click to edit`
if (entry) {
return `${currentPrice.toLocaleString()} — set ${formatLastUpdated(new Date(entry.editedAt))} — click to edit`
}
return exact ? `${exact} — click to set price` : 'Click to set price'
return 'Click to set price'
}
// ─── Order sort ───────────────────────────────────────────────────────────────