mirror of
https://github.com/arsvendg/Stirling-PDF.git
synced 2026-07-17 11:45:05 +02:00
Add frontend autoformatting and set CI to require formatted code for all languages (#6052)
# Description of Changes Changes the strategy for autoformatting to reject PRs if they are not formatted correctly instead of allowing them to merge and then spawning a new PR to fix the formatting. The old strategy just caused more work for us because we'd have to manually approve the followup PR and get it merged, which required 2 reviewers so in practice it rarely got done and just meant everyone's PRs ended up containing reformatting for unrelated files, which makes code review unnecessarily difficult. If the PR's code is not formatted correctly after this PR, a comment will be added automatically to tell the author how to run the formatter script to fix their code so it can go in. This also enables autoformatting for the frontend code, using Prettier. I've enabled it for pretty much everything in the frontend folder, other than 3rd party files and files it doesn't make sense for. I also excluded Markdown because it sounds likely to be more annoying to have to autoformat the Markdown in the frontend folder but nowhere else. Open to changing this though if people disagree. > [!note] > > Advice to reviewers: The first commit contains all of the actual logic I've introduced (CI changes, Prettier config, etc.) > The second commit is just the reformatting of the entire frontend folder. > The first commit needs proper review, the second one just give it a spot-check that it's doing what you'd expect.
This commit is contained in:
@@ -21,20 +21,20 @@ export const BILLING_CONFIG = {
|
||||
PLAN_PRICING_PRELOAD_THRESHOLD: 20,
|
||||
|
||||
// Stripe lookup keys
|
||||
PRO_PLAN_LOOKUP_KEY: 'plan:pro',
|
||||
METER_LOOKUP_KEY: 'meter:overage',
|
||||
PRO_PLAN_LOOKUP_KEY: "plan:pro",
|
||||
METER_LOOKUP_KEY: "meter:overage",
|
||||
|
||||
// Display formats
|
||||
CURRENCY_SYMBOLS: {
|
||||
gbp: '£',
|
||||
usd: '$',
|
||||
eur: '€',
|
||||
cny: '¥',
|
||||
inr: '₹',
|
||||
brl: 'R$',
|
||||
idr: 'Rp',
|
||||
jpy: '¥'
|
||||
} as const
|
||||
gbp: "£",
|
||||
usd: "$",
|
||||
eur: "€",
|
||||
cny: "¥",
|
||||
inr: "₹",
|
||||
brl: "R$",
|
||||
idr: "Rp",
|
||||
jpy: "¥",
|
||||
} as const,
|
||||
} as const;
|
||||
|
||||
/**
|
||||
@@ -49,8 +49,9 @@ export function getBillingConfig() {
|
||||
* @param currency Currency code (e.g., 'usd', 'gbp')
|
||||
* @param price Optional price override (defaults to BILLING_CONFIG.OVERAGE_PRICE_PER_CREDIT)
|
||||
*/
|
||||
export function getFormattedOveragePrice(currency: string = 'usd', price?: number): string {
|
||||
const symbol = BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] || '$';
|
||||
export function getFormattedOveragePrice(currency: string = "usd", price?: number): string {
|
||||
const symbol =
|
||||
BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] || "$";
|
||||
const amount = price ?? BILLING_CONFIG.OVERAGE_PRICE_PER_CREDIT;
|
||||
return `${symbol}${amount.toFixed(2)}`;
|
||||
}
|
||||
@@ -59,5 +60,8 @@ export function getFormattedOveragePrice(currency: string = 'usd', price?: numbe
|
||||
* Get currency symbol from currency code
|
||||
*/
|
||||
export function getCurrencySymbol(currency: string): string {
|
||||
return BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] || currency.toUpperCase();
|
||||
return (
|
||||
BILLING_CONFIG.CURRENCY_SYMBOLS[currency.toLowerCase() as keyof typeof BILLING_CONFIG.CURRENCY_SYMBOLS] ||
|
||||
currency.toUpperCase()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AppConfig } from '@app/contexts/AppConfigContext';
|
||||
import { AppConfig } from "@app/contexts/AppConfigContext";
|
||||
|
||||
/**
|
||||
* Default configuration used while the bundled backend starts up.
|
||||
|
||||
@@ -10,77 +10,77 @@ export interface PlanFeatureConfig {
|
||||
|
||||
export const FREE_PLAN_FEATURES: PlanFeatureConfig[] = [
|
||||
{
|
||||
translationKey: 'credits.modal.allInOneWorkspace',
|
||||
defaultText: 'All-in-one PDF workspace (viewer, tools & agent)'
|
||||
translationKey: "credits.modal.allInOneWorkspace",
|
||||
defaultText: "All-in-one PDF workspace (viewer, tools & agent)",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.fullyPrivateFiles',
|
||||
defaultText: 'Fully private files'
|
||||
translationKey: "credits.modal.fullyPrivateFiles",
|
||||
defaultText: "Fully private files",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.standardThroughput',
|
||||
defaultText: 'Standard throughput'
|
||||
translationKey: "credits.modal.standardThroughput",
|
||||
defaultText: "Standard throughput",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.customSmartFolders',
|
||||
defaultText: 'Custom Smart Folders'
|
||||
translationKey: "credits.modal.customSmartFolders",
|
||||
defaultText: "Custom Smart Folders",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.apiSandbox',
|
||||
defaultText: 'API sandbox'
|
||||
}
|
||||
translationKey: "credits.modal.apiSandbox",
|
||||
defaultText: "API sandbox",
|
||||
},
|
||||
];
|
||||
|
||||
export const TEAM_PLAN_FEATURES: PlanFeatureConfig[] = [
|
||||
{
|
||||
translationKey: 'credits.modal.unlimitedSeats',
|
||||
defaultText: 'Unlimited seats'
|
||||
translationKey: "credits.modal.unlimitedSeats",
|
||||
defaultText: "Unlimited seats",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.fasterThroughput',
|
||||
defaultText: '10x faster throughput'
|
||||
translationKey: "credits.modal.fasterThroughput",
|
||||
defaultText: "10x faster throughput",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.largeFileProcessing',
|
||||
defaultText: 'Large file processing'
|
||||
translationKey: "credits.modal.largeFileProcessing",
|
||||
defaultText: "Large file processing",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.premiumAiModels',
|
||||
defaultText: 'Premium AI models'
|
||||
translationKey: "credits.modal.premiumAiModels",
|
||||
defaultText: "Premium AI models",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.secureApiAccess',
|
||||
defaultText: 'Secure API access'
|
||||
translationKey: "credits.modal.secureApiAccess",
|
||||
defaultText: "Secure API access",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.prioritySupport',
|
||||
defaultText: 'Priority support'
|
||||
}
|
||||
translationKey: "credits.modal.prioritySupport",
|
||||
defaultText: "Priority support",
|
||||
},
|
||||
];
|
||||
|
||||
export const ENTERPRISE_PLAN_FEATURES: PlanFeatureConfig[] = [
|
||||
{
|
||||
translationKey: 'credits.modal.orgWideAccess',
|
||||
defaultText: 'Org-wide access controls'
|
||||
translationKey: "credits.modal.orgWideAccess",
|
||||
defaultText: "Org-wide access controls",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.privateDocCloud',
|
||||
defaultText: 'Private Document Cloud'
|
||||
translationKey: "credits.modal.privateDocCloud",
|
||||
defaultText: "Private Document Cloud",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.ragFineTuning',
|
||||
defaultText: 'RAG + fine-tuning'
|
||||
translationKey: "credits.modal.ragFineTuning",
|
||||
defaultText: "RAG + fine-tuning",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.unlimitedApiAccess',
|
||||
defaultText: 'Unlimited API access'
|
||||
translationKey: "credits.modal.unlimitedApiAccess",
|
||||
defaultText: "Unlimited API access",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.advancedMonitoring',
|
||||
defaultText: 'Advanced monitoring'
|
||||
translationKey: "credits.modal.advancedMonitoring",
|
||||
defaultText: "Advanced monitoring",
|
||||
},
|
||||
{
|
||||
translationKey: 'credits.modal.dedicatedSupportSlas',
|
||||
defaultText: 'Dedicated support & SLAs'
|
||||
}
|
||||
translationKey: "credits.modal.dedicatedSupportSlas",
|
||||
defaultText: "Dedicated support & SLAs",
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user