Skip to content

Commit fe06949

Browse files
committed
fix the cost calculator(regarding yearly calculation) and fix the cost of dorms in campus-life section
1 parent 6307fa1 commit fe06949

6 files changed

Lines changed: 31 additions & 22 deletions

File tree

.claude/settings.local.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(bun run lint)"
5+
]
6+
}
7+
}

app/campus-life/page.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,29 @@ export default function CampusLifePage() {
3131
const newDorms = [
3232
{
3333
title: "4-Person Suite",
34-
price: "~1,200 RMB/yr",
35-
features: ["2 Bedrooms (2 per room)", "Private Bathroom", "AC & Heating", "Modern Furnishings"],
34+
price: "~800 RMB/mo",
35+
features: ["2 Bedrooms (2 per room)", "Private Bathroom", "AC & Heating", "Does not provide free water", "Modern Furnishings"],
3636
image: dormImg1
3737
}
3838
];
3939

4040
const oldDorms = [
4141
{
4242
title: "2-Person Room",
43-
price: "~4,500 RMB/yr",
44-
features: ["Private Bathroom", "Balcony", "AC & Heating", "Desks & Storage"],
43+
price: "~900 RMB/mo",
44+
features: ["Private Bathroom", "Balcony", "AC & Heating", "Water is free", "Desks & Storage"],
4545
image: dormImg2
4646
},
4747
{
4848
title: "3-Person Room",
49-
price: "~3,500 RMB/yr",
50-
features: ["Private Bathroom", "Balcony", "AC & Heating", "Spacious Layout"],
49+
price: "~700 RMB/mo",
50+
features: ["Private Bathroom", "Balcony", "AC & Heating", "Water is free", "Spacious Layout"],
5151
image: dormImg2
5252
},
5353
{
5454
title: "4-Person Room",
55-
price: "900 RMB/yr",
56-
features: ["Private Bathroom", "Balcony", "Most Affordable", "Community Feel"],
55+
price: "900 RMB/mo",
56+
features: ["Private Bathroom", "Balcony", "Most Affordable", "Water is free", "Community Feel"],
5757
image: dormImg3
5858
}
5959
];

bun.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/features/CostCalculator.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ export function CostCalculator() {
3535
const tuitionOutOfPocket = tuition - tuitionCovered;
3636

3737
// Scholarship accommodation only covers International Dorm 4-Person Room
38-
const coveredDormCost = siteContent.housingOptions.find((h) => h.id === "intl-4p")?.cost ?? 0;
38+
// Housing costs are monthly — multiply by 12 for annual totals
39+
const coveredDormMonthly = siteContent.housingOptions.find((h) => h.id === "intl-4p")?.cost ?? 0;
40+
const coveredDormCost = coveredDormMonthly * 12;
3941
const accommodationCovered = cov?.accommodation ?? false;
4042
const effectiveHousing = accommodationCovered
4143
? siteContent.housingOptions.find((h) => h.id === "intl-4p")
4244
: selectedHousing;
4345
const isOnCampus = effectiveHousing?.type === "on-campus";
44-
const housingCost = effectiveHousing?.cost ?? 0;
46+
const housingCost = (effectiveHousing?.cost ?? 0) * 12;
4547
const housingCovered = accommodationCovered ? coveredDormCost : 0;
4648
const housingOutOfPocket = housingCost - housingCovered;
4749

@@ -152,7 +154,7 @@ export function CostCalculator() {
152154
{accommodationCovered ? (
153155
<>
154156
<div className="w-full px-4 py-3 rounded-xl border border-primary/30 bg-primary/5 text-sm font-medium">
155-
International Dorm 4-Person Room (¥{coveredDormCost.toLocaleString()}/yr)
157+
International Dorm 4-Person Room (¥{coveredDormMonthly.toLocaleString()}/mo — ¥{coveredDormCost.toLocaleString()}/yr)
156158
</div>
157159
<p className="text-xs text-primary mt-2">Scholarship accommodation covers the International Dorm 4-Person Room only.</p>
158160
</>
@@ -165,7 +167,7 @@ export function CostCalculator() {
165167
>
166168
{siteContent.housingOptions.map((h) => (
167169
<option key={h.id} value={h.id}>
168-
{h.name}{h.cost.toLocaleString()}/yr)
170+
{h.name}{h.cost.toLocaleString()}/mo — ¥{(h.cost * 12).toLocaleString()}/yr)
169171
</option>
170172
))}
171173
</select>

lib/content.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ export const siteContent = {
190190
},
191191
],
192192
housingOptions: [
193-
{ id: "intl-4p", name: "International Dorm 4-Person Room", cost: 900, type: "on-campus" as const },
194-
{ id: "intl-3p", name: "International Dorm 3-Person Room", cost: 3500, type: "on-campus" as const },
195-
{ id: "intl-2p", name: "International Dorm 2-Person Room", cost: 4500, type: "on-campus" as const },
196-
{ id: "bohou-4p", name: "Bohou 4-Person Suite", cost: 1200, type: "on-campus" as const },
197-
{ id: "off-campus", name: "Off-Campus Apartment", cost: 36000, type: "off-campus" as const },
193+
{ id: "intl-4p", name: "International Dorm 4-Person Room", cost: 500, type: "on-campus" as const },
194+
{ id: "intl-3p", name: "International Dorm 3-Person Room", cost: 700, type: "on-campus" as const },
195+
{ id: "intl-2p", name: "International Dorm 2-Person Room", cost: 900, type: "on-campus" as const },
196+
{ id: "bohou-4p", name: "Bohou 4-Person Suite", cost: 800, type: "on-campus" as const },
197+
{ id: "off-campus", name: "Off-Campus Apartment", cost: 1600, type: "off-campus" as const },
198198
],
199199
costs: {
200200
tuitionEnglish: 30000, // RMB per year (English-taught)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"framer-motion": "^12.29.0",
1818
"gsap": "^3.14.2",
1919
"lucide-react": "^0.563.0",
20-
"motion": "^12.29.2",
20+
"motion": "^12.30.0",
2121
"next": "16.1.4",
2222
"react": "19.2.3",
2323
"react-dom": "19.2.3",

0 commit comments

Comments
 (0)