feat(falukant): enhance marriage actions with production delay handling and UI updates
All checks were successful
Deploy to production / deploy (push) Successful in 2m58s
All checks were successful
Deploy to production / deploy (push) Successful in 2m58s
- Implemented logic in FalukantService to delay running productions when spending time with a spouse, updating the start timestamp accordingly. - Enhanced the response from the spend time API to include details about delayed productions and household order changes. - Updated FamilyView component to display the cost of marriage actions and added a help section detailing the effects of actions, including production delays. - Added new translations for action effects in multiple languages to improve user understanding of the marriage actions.
This commit is contained in:
@@ -238,21 +238,30 @@
|
||||
<h3>{{ $t('falukant.family.marriageActions.title') }}</h3>
|
||||
<div class="marriage-actions__buttons">
|
||||
<button class="button button--secondary" @click="spendTimeWithSpouse">
|
||||
{{ $t('falukant.family.marriageActions.spendTime') }}
|
||||
{{ $t('falukant.family.marriageActions.spendTime') }} ({{ $t('falukant.family.marriageActions.costFree') }})
|
||||
</button>
|
||||
<button class="button button--secondary" @click="giftToSpouse('small')">
|
||||
{{ $t('falukant.family.marriageActions.giftSmall') }}
|
||||
{{ $t('falukant.family.marriageActions.giftSmall') }} ({{ formatCost(marriageGiftCosts.small) }})
|
||||
</button>
|
||||
<button class="button button--secondary" @click="giftToSpouse('decent')">
|
||||
{{ $t('falukant.family.marriageActions.giftDecent') }}
|
||||
{{ $t('falukant.family.marriageActions.giftDecent') }} ({{ formatCost(marriageGiftCosts.decent) }})
|
||||
</button>
|
||||
<button class="button button--secondary" @click="giftToSpouse('lavish')">
|
||||
{{ $t('falukant.family.marriageActions.giftLavish') }}
|
||||
{{ $t('falukant.family.marriageActions.giftLavish') }} ({{ formatCost(marriageGiftCosts.lavish) }})
|
||||
</button>
|
||||
<button class="button button--secondary" @click="reconcileMarriage">
|
||||
{{ $t('falukant.family.marriageActions.reconcile') }}
|
||||
{{ $t('falukant.family.marriageActions.reconcile') }} ({{ $t('falukant.family.marriageActions.costFree') }})
|
||||
</button>
|
||||
</div>
|
||||
<details class="marriage-actions__help">
|
||||
<summary>{{ $t('falukant.family.marriageActions.effectHintTitle') }}</summary>
|
||||
<ul>
|
||||
<li>{{ $t('falukant.family.marriageActions.effectSpendTime', { minutes: 15 }) }}</li>
|
||||
<li>{{ $t('falukant.family.marriageActions.effectGifts', { small: formatCost(marriageGiftCosts.small), decent: formatCost(marriageGiftCosts.decent), lavish: formatCost(marriageGiftCosts.lavish) }) }}</li>
|
||||
<li>{{ $t('falukant.family.marriageActions.effectReconcile') }}</li>
|
||||
<li>{{ $t('falukant.family.marriageActions.effectProduction', { minutes: 15 }) }}</li>
|
||||
</ul>
|
||||
</details>
|
||||
<div v-if="householdTensionReasons.length > 0" class="marriage-actions__reasons">
|
||||
<span class="marriage-actions__reasons-label">{{ $t('falukant.family.householdTension.reasonsLabel') }}</span>
|
||||
<div class="marriage-actions__reason-list">
|
||||
@@ -486,6 +495,11 @@ import { confirmAction, showError, showInfo, showSuccess } from '@/utils/feedbac
|
||||
import { mapState } from 'vuex'
|
||||
|
||||
const WOOING_PROGRESS_TARGET = 70
|
||||
const MARRIAGE_GIFT_COSTS = {
|
||||
small: 25,
|
||||
decent: 80,
|
||||
lavish: 180
|
||||
}
|
||||
|
||||
export default {
|
||||
name: 'FamilyView',
|
||||
@@ -527,6 +541,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState(['socket', 'daemonSocket', 'user']),
|
||||
marriageGiftCosts() {
|
||||
return MARRIAGE_GIFT_COSTS;
|
||||
},
|
||||
partnerSummaryLine() {
|
||||
if (this.relationships?.length > 0) {
|
||||
const r = this.relationships[0];
|
||||
@@ -713,8 +730,20 @@ export default {
|
||||
|
||||
async spendTimeWithSpouse() {
|
||||
try {
|
||||
await apiClient.post('/api/falukant/family/marriage/spend-time');
|
||||
const { data } = await apiClient.post('/api/falukant/family/marriage/spend-time');
|
||||
await this.loadFamilyData();
|
||||
const delayed = Number(data?.delayedProductions || 0);
|
||||
const delayMinutes = Number(data?.productionDelayMinutes || 15);
|
||||
if (delayed > 0) {
|
||||
showInfo(
|
||||
this,
|
||||
this.$t('falukant.family.marriageActions.spendTimeSuccessWithDelay', {
|
||||
count: delayed,
|
||||
minutes: delayMinutes
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
showSuccess(this, this.$t('falukant.family.marriageActions.spendTimeSuccess'));
|
||||
} catch (error) {
|
||||
console.error('Error spending time with spouse:', error);
|
||||
@@ -1217,6 +1246,21 @@ export default {
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.marriage-actions__help {
|
||||
margin: -2px 0 0;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.marriage-actions__help summary {
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.marriage-actions__help ul {
|
||||
margin: 8px 0 0;
|
||||
padding-left: 18px;
|
||||
}
|
||||
|
||||
.marriage-actions__reasons {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
|
||||
Reference in New Issue
Block a user