小小优化

This commit is contained in:
Yeban8090 2025-07-05 22:07:02 +08:00
parent 14990fb6d3
commit cbce26519d
4 changed files with 3 additions and 49 deletions

View file

@ -1,7 +1,7 @@
{
"id": "book-smith",
"name": "Book Smith",
"version": "1.0.3",
"version": "1.0.4",
"minAppVersion": "0.15.0",
"description": "Simplify long-form writing and book creation. Organize chapters, track progress, and export your manuscript in various formats for a seamless publishing workflow.",
"author": "Yeban",

View file

@ -119,7 +119,7 @@ const toolViewTranslation: ToolViewTranslation = {
// 导出发布
EXPORT_PUBLISH: 'Export & publish',
DESIGN_TYPOGRAPHY: 'Design & typography',
DESIGN_TYPOGRAPHY: 'Generate e-book',
GENERATE_EBOOK: 'Generate e-book',
MORE_FEATURES: 'More features...',
MORE_FEATURES_MESSAGE: 'More features coming with your participation',

View file

@ -118,7 +118,7 @@ const toolViewTranslation: ToolViewTranslation = {
// 导出发布
EXPORT_PUBLISH: '导出发布',
DESIGN_TYPOGRAPHY: '设计排版',
DESIGN_TYPOGRAPHY: '生成电子书',
GENERATE_EBOOK: '生成电子书',
MORE_FEATURES: '更多功能...',
MORE_FEATURES_MESSAGE: '更多功能等你一起共创',

View file

@ -5,20 +5,12 @@ import { i18n } from '../i18n/i18n';
import { kofiImage } from '../assets/kofi3';
export class DonateModal extends BaseModal {
private selectedAmount: number = 6;
private amounts = [
{ value: 6, label: i18n.t('DONATE_AMOUNT_COFFEE'), icon: '☕️', feedback: i18n.t('DONATE_FEEDBACK_COFFEE') },
{ value: 18, label: i18n.t('DONATE_AMOUNT_CHAPTER'), icon: '📖', feedback: i18n.t('DONATE_FEEDBACK_CHAPTER') },
{ value: 66, label: i18n.t('DONATE_AMOUNT_FEATURE'), icon: '🎨', feedback: i18n.t('DONATE_FEEDBACK_FEATURE') }
];
constructor(container: HTMLElement) {
super(container, i18n.t('DONATE_MODAL_TITLE'));
}
protected createContent() {
this.createCommunityStats();
this.createAmountPanel();
this.createPaymentChannels();
}
@ -41,29 +33,6 @@ export class DonateModal extends BaseModal {
});
}
private createAmountPanel() {
const panel = this.element.createDiv({ cls: 'book-smith-amount-panel' });
const presets = panel.createDiv({ cls: 'amount-presets' });
this.amounts.forEach(amount => {
const btn = presets.createDiv({ cls: 'amount-btn' });
const content = btn.createDiv({ cls: 'amount-content' });
content.createSpan({ cls: 'amount-icon', text: amount.icon });
content.createSpan({ cls: 'amount-label', text: amount.label });
content.createSpan({ cls: 'amount-value', text: `${amount.value}${i18n.t('CURRENCY_UNIT')}` });
if (amount.value === this.selectedAmount) {
btn.addClass('selected');
}
btn.addEventListener('click', () => {
this.selectAmount(amount.value);
this.animateSelection(btn);
this.showNotice(amount.feedback);
});
});
}
private createPaymentChannels() {
const channels = this.element.createDiv({ cls: 'payment-channels' });
@ -133,19 +102,4 @@ export class DonateModal extends BaseModal {
inactiveTabs.forEach(tab => tab.removeClass('active'));
inactiveContents.forEach(content => content.removeClass('active'));
}
private selectAmount(amount: number) {
this.selectedAmount = amount;
const buttons = this.element.querySelectorAll('.amount-btn');
buttons.forEach(btn => {
const valueText = btn.querySelector('.amount-value')?.textContent;
const value = valueText ? parseInt(valueText) : 0;
btn.toggleClass('selected', value === amount);
});
}
private animateSelection(btn: HTMLElement) {
btn.addClass('pulse');
setTimeout(() => btn.removeClass('pulse'), 1000);
}
}