diff --git a/app/share/page.tsx b/app/share/page.tsx
index a9a335a..f6c1642 100644
--- a/app/share/page.tsx
+++ b/app/share/page.tsx
@@ -3,6 +3,8 @@
import { useSearchParams } from 'next/navigation';
import ShareCard from '@/components/ShareCard';
import React, { Suspense } from 'react';
+import { LanguageProvider } from '@/components/LanguageContext';
+import { LanguageSwitcher } from '@/components/LanguageSwitcher';
// 一个包装组件,负责从URL参数获取数据
function ShareCardWrapper() {
@@ -17,8 +19,10 @@ function ShareCardWrapper() {
const commuteHours = searchParams.get('commuteHours') || '2';
const restTime = searchParams.get('restTime') || '2';
const dailySalary = searchParams.get('dailySalary') || '0';
- const isYuan = searchParams.get('isYuan') === 'true';
+ const isYuan = searchParams.get('isYuan') || 'true';
const workDaysPerYear = searchParams.get('workDaysPerYear') || '250';
+ const countryCode = searchParams.get('countryCode') || 'CN';
+ const countryName = searchParams.get('countryName') || '中国';
// 额外参数 - 详细工作信息
const workDaysPerWeek = searchParams.get('workDaysPerWeek') || '5';
@@ -44,55 +48,73 @@ function ShareCardWrapper() {
const jobStability = searchParams.get('jobStability') || 'private';
return (
-
+
+
+
);
}
// 加载过程中显示的组件
function ShareLoading() {
- return
正在加载报告...
;
+ return (
+
+
正在加载报告...
+
Loading report...
+
+ );
}
// 主页面组件
export default function SharePage() {
return (
-
}>
-
-
+
+
+
+
+
);
}
\ No newline at end of file
diff --git a/components/LanguageContext.tsx b/components/LanguageContext.tsx
new file mode 100644
index 0000000..48c614b
--- /dev/null
+++ b/components/LanguageContext.tsx
@@ -0,0 +1,511 @@
+"use client";
+
+import React, { createContext, useContext, useState, useEffect, ReactNode } from 'react';
+
+// 定义语言类型
+export type Language = 'zh' | 'en';
+
+// 创建上下文接口
+interface LanguageContextType {
+ language: Language;
+ setLanguage: (language: Language) => void;
+ t: (key: string) => string;
+}
+
+// 创建默认上下文
+const defaultContext: LanguageContextType = {
+ language: 'zh',
+ setLanguage: () => {},
+ t: (key: string) => key,
+};
+
+// 创建上下文
+const LanguageContext = createContext
(defaultContext);
+
+// 翻译数据
+const translations: Record> = {
+ zh: {
+ // 标题和导航
+ 'title': '这b班上得值不值·测算版',
+ 'version': 'v5.0.0',
+ 'github': 'GitHub',
+ 'email': 'Email',
+ 'xiaohongshu': '小红书',
+ 'redirect_notice': '已自动跳转,新网址无需科学上网',
+ 'visits': '访问量',
+ 'visitors': '访客数',
+
+ // 表单标签
+ 'annual_salary_cny': '年薪总包(元)',
+ 'annual_salary_foreign': '年薪总包(当地货币)',
+ 'salary_placeholder_cny': '税前年薪',
+ 'salary_placeholder_foreign': '使用当地货币',
+ 'non_china_salary': '非中国地区薪资',
+ 'ppp_factor': '购买力平价(PPP)转换因子',
+ 'ppp_tooltip': 'PPP转换因子是将各国货币购买力标准化的指标。例如中国为4.19,表示1美元在美国的购买力等同于4.19元人民币在中国的购买力。',
+ 'ppp_placeholder': '请输入购买力平价转换因子',
+ 'ppp_common_regions': '常见地区:中国大陆:4.19, 日本:102.59, 美国:1.00, 新加坡:0.84',
+ 'view_more': '查看更多',
+ 'country_selection': '工作国家/地区',
+ 'selected_ppp': '当前PPP值',
+ 'work_days_per_week': '每周工作天数/d',
+ 'wfh_days_per_week': '周WFH天数/d',
+ 'wfh_tooltip': 'WFH指居家办公(Work From Home),这里填写的是前面工作天数中有多少天是在家办公的。',
+ 'annual_leave': '年假天数/d',
+ 'public_holidays': '法定假日/d',
+ 'paid_sick_leave': '带薪病假/d',
+ 'work_hours': '工时/h',
+ 'work_hours_tooltip': '工时:是指"下班时间-上班时间"的总时间,包括吃饭、午休、加班等(不含通勤)。',
+ 'commute_hours': '通勤/h',
+ 'commute_tooltip': '通勤时长是指上下班往返的总时间,即家到公司和公司回家的时间总和。',
+ 'rest_time': '休息&摸鱼',
+
+ // 环境系数
+ 'job_stability': '合同类型',
+ 'job_private': '私企续签',
+ 'job_foreign': '外企续签',
+ 'job_state': '长期雇佣',
+ 'job_government': '永久编制',
+ 'work_environment': '工作环境',
+ 'env_remote': '偏僻的工厂/工地/户外',
+ 'env_factory': '工厂/工地/户外',
+ 'env_normal': '普通环境',
+ 'env_cbd': 'CBD',
+ 'city_factor': '所在城市(按生活成本选择)',
+ 'city_tier1': '一线城市',
+ 'city_newtier1': '新一线',
+ 'city_tier2': '二线城市',
+ 'city_tier3': '三线城市',
+ 'city_tier4': '四线城市',
+ 'city_county': '县城',
+ 'city_town': '乡镇',
+ 'hometown': '是否在家乡工作',
+ 'not_hometown': '不在家乡',
+ 'is_hometown': '在家乡',
+ 'leadership': '领导/老板',
+ 'leader_bad': '对我不爽',
+ 'leader_strict': '管理严格',
+ 'leader_normal': '中规中矩',
+ 'leader_good': '善解人意',
+ 'leader_favorite': '我是嫡系',
+ 'teamwork': '同事环境',
+ 'team_bad': '都是傻逼',
+ 'team_normal': '萍水相逢',
+ 'team_good': '和和睦睦',
+ 'team_excellent': '私交甚好',
+ 'shuttle': '班车服务(加分项)',
+ 'shuttle_none': '无班车',
+ 'shuttle_inconvenient': '班车不便',
+ 'shuttle_convenient': '便利班车',
+ 'shuttle_direct': '班车直达',
+ 'canteen': '食堂情况(加分项)',
+ 'canteen_none': '无食堂/很难吃',
+ 'canteen_average': '食堂一般',
+ 'canteen_good': '食堂不错',
+ 'canteen_excellent': '食堂超赞',
+
+ // 教育和工作经验
+ 'education_level': '个人学历水平',
+ 'degree_type': '学位类型',
+ 'below_bachelor': '专科及以下',
+ 'bachelor': '本科',
+ 'masters': '硕士',
+ 'phd': '博士',
+ 'school_type': '学校类型',
+ 'school_second_tier': '二本三本',
+ 'school_first_tier_bachelor': '双非/ QS200/ USnews80',
+ 'school_elite_bachelor': '985211/ QS50/ USnews30',
+ 'school_first_tier_higher': '双非/ QS100/ USnews50',
+ 'school_elite_higher': '985211/ QS30/ USnews20',
+ 'bachelor_background': '本科背景',
+ 'work_years': '工作年限',
+ 'fresh_graduate': '应届生',
+ 'years_1_3': '1-3年',
+ 'years_3_5': '3-5年',
+ 'years_5_8': '5-8年',
+ 'years_8_10': '8-10年',
+ 'years_10_12': '10-12年',
+ 'years_above_12': '12年以上',
+
+ // 结果
+ 'working_days_per_year': '年工作天数',
+ 'days_unit': '天',
+ 'average_daily_salary': '平均日薪',
+ 'job_value': '工作性价比',
+ 'view_report': '查看我的工作性价比报告',
+
+ // ShareCard组件
+ 'share_back_to_calculator': '返回计算器',
+ 'share_your_job_worth_report': '你的工作性价比报告',
+ 'share_job_worth_report': '工作性价比报告',
+ 'share_custom_made': '由"这b班上得值不值·测算版"精心定制',
+ 'share_generating': '生成中...',
+ 'share_download_report': '下载报告',
+ 'share_basic_info': '基础信息',
+ 'share_work_city': '工作城市',
+ 'share_is_hometown': '是否家乡',
+ 'share_yes': '是',
+ 'share_no': '否',
+ 'share_daily_salary': '日薪',
+ 'share_day': '天',
+ 'share_days': '天',
+ 'share_work_hours_title': '工作时间',
+ 'share_hours': '小时',
+ 'share_daily_work_hours': '每天工作',
+ 'share_daily_commute_hours': '每天通勤',
+ 'share_rest_time': '午休与休息',
+ 'share_weekly_work_days': '每周工作天数',
+ 'share_remote_work': '远程办公',
+ 'share_days_per_week': '天/周',
+ 'share_shuttle_service': '班车服务',
+ 'share_annual_leave': '年假',
+ 'share_paid_sick_leave': '带薪病假',
+ 'share_days_per_year': '天/年',
+ 'share_work_environment_title': '工作环境',
+ 'share_office_environment': '办公环境',
+ 'share_leadership_relation': '领导关系',
+ 'share_colleague_relationship': '同事关系',
+ 'share_canteen_quality': '食堂情况',
+ 'share_education_and_experience': '教育与工作经验',
+ 'share_highest_degree': '最高学历',
+ 'share_school_type_label': '学校类型',
+ 'share_work_years_label': '工作年限',
+ 'share_contract_type_label': '合同类型',
+ 'share_final_assessment': '最终评估',
+ 'share_low_value_assessment_1': '这份工作对你来说简直是一场噩梦,每一天都是艰难的挑战。',
+ 'share_low_value_assessment_2': '这份工作让你疲惫不堪,但或许是通往更好未来的必经之路。',
+ 'share_medium_value_assessment_1': '这份工作平平淡淡,既没有太多惊喜,也没有太多失望。',
+ 'share_medium_value_assessment_2': '这份工作给你带来了不少成就感,是一份令人满意的选择。',
+ 'share_high_value_assessment_1': '这份工作几乎满足了你的所有期望,每天都充满干劲。',
+ 'share_high_value_assessment_2': '这份工作简直是为你量身定做的,既有挑战又有回报,令你心满意足。',
+ 'share_high_value_assessment_3': '恭喜你找到了人生中的理想工作,这样的机会可遇而不可求!',
+ 'share_working_days_per_year': '年工作天数',
+
+ 'share_hometown_comment': '在家乡工作,让你既能追求事业,又能照顾家人,平衡感满满。家的温暖和熟悉的环境给你带来额外的安全感和幸福感。',
+ 'share_tier1_city_comment': '虽然生活成本较高,但丰富的机会和广阔的平台能够助你更快成长。',
+ 'share_tier2_city_comment': '生活节奏虽然没有一线城市那么快,但依然提供了不错的发展空间。这里的生活压力适中,让你能找到工作与生活之间的平衡。',
+ 'share_tier3_city_comment': '你享受着低成本高质量的生活。虽然机会相对较少,但悠闲的生活节奏和较低的压力让你能更从容地面对人生。要照顾好自己,按时吃饭休息,你一个人去得那么远。',
+
+ 'share_commute_short': '你的通勤时间很短,让你每天都能多出宝贵的时间用于自我提升或休息。',
+ 'share_commute_medium': '你的通勤时间适中,不会让你感到太大压力,也可以利用这段时间听书或补觉。',
+ 'share_commute_long': '你长时间的通勤占用了大量宝贵时间,会对身心健康造成一定影响,建议考虑搬家或换工作以改善。',
+ 'share_wfh_high': '而且你有大量居家办公的机会,进一步减轻了通勤负担,提高了工作生活质量。',
+ 'share_wfh_medium': '你的部分居家办公安排也为你节省了不少通勤时间。',
+ 'share_shuttle_service_good': '公司提供的便利班车服务是一个不小的福利,让你的通勤更轻松愉快。',
+
+ 'share_cbd_environment': '在CBD的办公环境既专业又现代化,提供了良好的职业形象和便利的工作条件。',
+ 'share_factory_environment': '在工厂/户外环境工作确实有些挑战,但也培养了你的坚韧品质和适应能力。',
+ 'share_normal_environment': '你的工作环境舒适适中,能满足基本需求,为高效工作提供了足够的保障。',
+ 'share_leadership_excellent': '你享受着作为嫡系的优越待遇和发展机会,但也面临着更高的期望和责任。',
+ 'share_leadership_good': '你的领导能够理解你的工作状态并提供必要的支持,这在职场中非常难得。',
+ 'share_leadership_normal': '你和领导各司其职,这种关系虽然普通但稳定可靠。',
+ 'share_leadership_strict': '你领导的管理风格较为严格,这种严格虽然有时让人压力大,但也能促使你更加专业和自律。',
+ 'share_leadership_bad': '你与领导之间的关系有些紧张,这种情况下要学会保持情绪稳定,专注于工作本身,同时提升自己的沟通技巧。',
+ 'share_teamwork_excellent': '你与同事们建立了深厚的私人友谊,工作之余还能互相支持和陪伴,这种关系让职场生活更加充实和有意义。',
+ 'share_teamwork_good': '团队氛围和谐友善,同事之间相互尊重和支持,这种积极的人际环境让工作过程更加愉快和高效。',
+ 'share_teamwork_normal': '与同事们相处和平但不过分亲近,这种关系模式适合专注于工作的职场人士。',
+ 'share_teamwork_bad': '同事关系略显紧张,这种环境虽然不太舒适,但也锻炼了你的独立工作能力和心理承受力。',
+
+ 'share_workhours_balanced': '你的工作强度适中,有足够的时间照顾个人生活,保持着良好的工作生活平衡。',
+ 'share_workhours_long': '你的工作时间略长,但仍在可接受范围内。注意合理安排休息时间,避免长期疲劳。',
+ 'share_workhours_excessive': '你的工作时间过长,长期如此可能影响健康和生活质量。建议寻找方法提高效率或与上级商量调整工作安排。',
+ 'share_rest_adequate': '你有充足的休息和午休时间,这有助于恢复精力,提高下午的工作效率。',
+ 'share_rest_insufficient': '你的休息时间较少,记得定期起身活动,防止久坐带来的健康问题。',
+ 'share_leave_abundant': '丰富的年假让你有充分的时间休整和旅行,这对维持长期工作动力非常重要。',
+ 'share_leave_limited': '你的年假较少,可以考虑更有效地规划和利用这些宝贵的休假时间。',
+
+ 'share_phd_comment': '博士学历是你职场的一张重要名片,为你打开了许多高端研究和专业岗位的大门。',
+ 'share_masters_comment': '硕士学历在当今就业市场仍有一定优势,证明了你的学习能力和专业素养。',
+ 'share_bachelor_comment': '本科学历为你的职业生涯奠定了坚实基础,结合实际经验,你能在各个领域找到发展机会。',
+ 'share_below_bachelor_comment': '专科及以下学历虽然在某些领域可能面临挑战,但实践经验和专业技能同样能帮你赢得认可。',
+ 'share_fresh_graduate_comment': '作为应届生,你充满朝气和学习热情,有无限的可能性去探索和成长。',
+ 'share_experienced_comment': '多年的工作经验是你最宝贵的财富,让你在职场中更加从容和自信。',
+ 'share_mid_career_comment': '几年的工作经验让你更加了解行业和自己的优势,职业发展正处于上升期。',
+ 'share_government_job_comment': '体制内的工作稳定性高,让你无需过多担忧失业风险,可以更从容地规划未来。',
+ 'share_private_job_comment': '私企的工作虽然有一定风险,但也提供了更多成长和收入提升的机会。',
+
+ 'share_salary_high_cny': '你的日薪处于较高水平,财务状况良好,能够满足日常生活和一定的休闲娱乐需求。',
+ 'share_salary_medium_cny': '你的日薪处于中等水平,足以应对基本生活需求,但可能需要更细致的预算规划。',
+ 'share_salary_low_cny': '你的日薪较低,可能需要精打细算来管理财务,同时寻找提升收入的机会。',
+ 'share_salary_high_foreign': '你的日薪处于较高水平,财务状况良好,能够满足日常生活和一定的休闲娱乐需求。',
+ 'share_salary_medium_foreign': '你的日薪处于中等水平,足以应对基本生活需求,但可能需要更细致的预算规划。',
+ 'share_salary_low_foreign': '你的日薪较低,可能需要精打细算来管理财务,同时寻找提升收入的机会。',
+ 'share_high_cost_city': '在高生活成本的城市,你的薪资需要更精明地管理才能达到理想的生活质量。',
+ 'share_low_cost_city': '在低生活成本的地区,你的薪资能够带来更高的生活质量和更多的储蓄机会。',
+
+ 'share_value_low': '虽然目前的工作性价比较低,但这可能是积累经验的必经阶段。记住每份工作都有其价值,努力汲取经验,为下一步发展打好基础。',
+ 'share_value_medium': '你的工作性价比处于中等水平,有优点也有不足。可以专注于现有优势,同时寻找提升不足方面的方法,让工作体验更加全面。',
+ 'share_value_high': '恭喜你拥有高性价比的工作!这样的机会难得,要珍惜现在的环境,继续发挥自己的优势,享受工作带来的成就感和满足感。',
+ 'share_summary_advice': '综合建议',
+
+ // 评价
+ 'rating_enter_salary': '请输入年薪',
+ 'rating_terrible': '惨绝人寰',
+ 'rating_poor': '略惨',
+ 'rating_average': '一般',
+ 'rating_good': '还不错',
+ 'rating_great': '很爽',
+ 'rating_excellent': '爽到爆炸',
+ 'rating_perfect': '人生巅峰',
+ 'share_country': '工作国家/地区',
+ },
+ en: {
+ // Title and navigation
+ 'title': 'Is This Job Worth It?',
+ 'version': 'v5.0.0',
+ 'github': 'GitHub',
+ 'email': 'Email',
+ 'xiaohongshu': 'Rednote',
+ 'redirect_notice': 'Redirected automatically to new domain',
+ 'visits': 'Visits',
+ 'visitors': 'Visitors',
+
+ // Form labels
+ 'annual_salary_cny': 'Annual Salary (CNY)',
+ 'annual_salary_foreign': 'Annual Salary (Local Currency)',
+ 'salary_placeholder_cny': 'Pre-tax annual salary',
+ 'salary_placeholder_foreign': 'Use local currency',
+ 'non_china_salary': 'Non-China Salary',
+ 'ppp_factor': 'Purchasing Power Parity Factor',
+ 'ppp_tooltip': 'PPP factor standardizes purchasing power across countries. For example, China\'s 4.19 means that 1 USD in US has the same purchasing power as 4.19 CNY in China.',
+ 'ppp_placeholder': 'Enter PPP conversion factor',
+ 'ppp_common_regions': 'Common regions: China:4.19, Japan:102.59, US:1.00, Singapore:0.84',
+ 'view_more': 'View more',
+ 'country_selection': 'Work Country/Region',
+ 'selected_ppp': 'Current PPP value',
+ 'work_days_per_week': 'Workdays/week',
+ 'wfh_days_per_week': 'WFH days/week',
+ 'wfh_tooltip': 'WFH means Work From Home. Enter how many of your weekly workdays are spent working from home.',
+ 'annual_leave': 'Annual leave /d',
+ 'public_holidays': 'Public holidays',
+ 'paid_sick_leave': 'Paid sick days',
+ 'work_hours': 'Work hours /h',
+ 'work_hours_tooltip': 'Work hours: total time from start to end of workday, including meals, breaks, and overtime (excluding commute).',
+ 'commute_hours': 'Commute hours',
+ 'commute_tooltip': 'Commute time refers to the total round-trip time between home and office.',
+ 'rest_time': 'Breaks & slacking/h',
+
+ // Environment factors
+ 'job_stability': 'Contract Type',
+ 'job_private': 'Private Company',
+ 'job_foreign': 'Foreign Company',
+ 'job_state': 'State-Owned Enterprise',
+ 'job_government': 'Government Position',
+ 'work_environment': 'Work Environment',
+ 'env_remote': 'Remote Factory/ Site/ Outdoor',
+ 'env_factory': 'Factory/ Site/ Outdoor',
+ 'env_normal': 'Standard Office',
+ 'env_cbd': 'CBD Office',
+ 'city_factor': 'City (by Cost of Living)',
+ 'city_tier1': 'Major Metropolis',
+ 'city_newtier1': 'Emerging Major City',
+ 'city_tier2': 'Regional Center',
+ 'city_tier3': 'Medium-sized City',
+ 'city_tier4': 'Small City',
+ 'city_county': 'County',
+ 'city_town': 'Township',
+ 'hometown': 'Working in Hometown?',
+ 'not_hometown': 'Not Hometown',
+ 'is_hometown': 'In Hometown',
+ 'leadership': 'Manager/Boss',
+ 'leader_bad': 'Difficult Relationship',
+ 'leader_strict': 'Strict Management',
+ 'leader_normal': 'Professional & Neutral',
+ 'leader_good': 'Supportive Leadership',
+ 'leader_favorite': 'Inner Circle Member',
+ 'teamwork': 'Team Environment',
+ 'team_bad': 'Toxic Environment',
+ 'team_normal': 'Professional Colleagues',
+ 'team_good': 'Collaborative Team',
+ 'team_excellent': 'Close-knit Team',
+ 'shuttle': 'Shuttle Service (Bonus)',
+ 'shuttle_none': 'No Shuttle',
+ 'shuttle_inconvenient': 'Inconvenient Shuttle',
+ 'shuttle_convenient': 'Convenient Shuttle',
+ 'shuttle_direct': 'Direct Route Shuttle',
+ 'canteen': 'Canteen Quality (Bonus)',
+ 'canteen_none': 'No Canteen/Poor Quality',
+ 'canteen_average': 'Average Quality',
+ 'canteen_good': 'Good Quality',
+ 'canteen_excellent': 'Excellent Quality',
+
+ // Education and work experience
+ 'education_level': 'Education Level',
+ 'degree_type': 'Degree Type',
+ 'below_bachelor': 'Below Bachelor\'s',
+ 'bachelor': 'Bachelor\'s',
+ 'masters': 'Master\'s',
+ 'phd': 'PhD',
+ 'school_type': 'University Type',
+ 'school_second_tier': 'Standard University',
+ 'school_first_tier_bachelor': 'Top University/QS200/USnews80',
+ 'school_elite_bachelor': 'Elite University/QS50/USnews30',
+ 'school_first_tier_higher': 'Top Grad School/QS100/USnews50',
+ 'school_elite_higher': 'Elite Grad School/QS30/USnews20',
+ 'bachelor_background': 'Bachelor Background',
+ 'work_years': 'Work Experience',
+ 'fresh_graduate': 'Fresh Graduate',
+ 'years_1_3': '1-3 years',
+ 'years_3_5': '3-5 years',
+ 'years_5_8': '5-8 years',
+ 'years_8_10': '8-10 years',
+ 'years_10_12': '10-12 years',
+ 'years_above_12': '12+ years',
+
+ // Results
+ 'working_days_per_year': 'Working days/year',
+ 'days_unit': 'days',
+ 'average_daily_salary': 'Average daily salary',
+ 'job_value': 'Job Value Rating',
+ 'view_report': 'View my job worth report',
+
+ // ShareCard Component
+ 'share_back_to_calculator': 'Back to Calculator',
+ 'share_your_job_worth_report': 'Your Job Worth Report',
+ 'share_job_worth_report': 'Job Worth Report',
+ 'share_custom_made': 'Custom made by "Is This Job Worth It?"',
+ 'share_generating': 'Generating...',
+ 'share_download_report': 'Download Report',
+ 'share_basic_info': 'Basic Information',
+ 'share_work_city': 'Work City',
+ 'share_is_hometown': 'Hometown',
+ 'share_yes': 'Yes',
+ 'share_no': 'No',
+ 'share_daily_salary': 'Daily Salary',
+ 'share_day': 'day',
+ 'share_days': 'days',
+ 'share_work_hours_title': 'Work Hours',
+ 'share_hours': 'hours',
+ 'share_daily_work_hours': 'Daily Work',
+ 'share_daily_commute_hours': 'Daily Commute',
+ 'share_rest_time': 'Breaks & Rest',
+ 'share_weekly_work_days': 'Weekly Workdays',
+ 'share_remote_work': 'Remote Work',
+ 'share_days_per_week': 'days/week',
+ 'share_shuttle_service': 'Shuttle Service',
+ 'share_annual_leave': 'Annual Leave',
+ 'share_paid_sick_leave': 'Paid Sick Leave',
+ 'share_days_per_year': 'days/year',
+ 'share_work_environment_title': 'Work Environment',
+ 'share_office_environment': 'Office Environment',
+ 'share_leadership_relation': 'Leadership',
+ 'share_colleague_relationship': 'Colleague Relations',
+ 'share_canteen_quality': 'Canteen',
+ 'share_education_and_experience': 'Education & Experience',
+ 'share_highest_degree': 'Highest Degree',
+ 'share_school_type_label': 'School Type',
+ 'share_work_years_label': 'Work Years',
+ 'share_contract_type_label': 'Contract Type',
+ 'share_final_assessment': 'Final Assessment',
+ 'share_low_value_assessment_1': 'This job feels like a daily struggle, with challenges that outweigh the benefits.',
+ 'share_low_value_assessment_2': 'This job is quite demanding, but might be a stepping stone to better opportunities.',
+ 'share_medium_value_assessment_1': 'This job is balanced - not particularly exciting but stable and manageable.',
+ 'share_medium_value_assessment_2': 'This job offers good satisfaction and rewards that match your efforts.',
+ 'share_high_value_assessment_1': 'This job meets most of your expectations, providing meaningful work and fair compensation.',
+ 'share_high_value_assessment_2': 'This job seems tailor-made for you, offering both challenge and reward in perfect measure.',
+ 'share_high_value_assessment_3': "You've found an exceptional job opportunity that offers extraordinary value and satisfaction!",
+ 'share_working_days_per_year': 'Working days/year',
+
+ 'share_hometown_comment': 'Working in your hometown allows you to build your career while maintaining family connections - a valuable balance that contributes to overall life satisfaction.',
+ 'share_tier1_city_comment': 'While living costs are high, the abundant opportunities and professional networks in major cities can accelerate your career growth.',
+ 'share_tier2_city_comment': 'This regional center offers a good balance - decent career opportunities with more manageable living costs and work pressure compared to major cities.',
+ 'share_tier3_city_comment': 'You enjoy a good quality of life with lower living costs. While career opportunities may be more limited, the relaxed pace and lower pressure are significant advantages.',
+
+ 'share_commute_short': 'Your short commute time gives you more precious time each day for personal development or relaxation.',
+ 'share_commute_medium': 'Your moderate commute is manageable and can be used productively for reading or podcasts.',
+ 'share_commute_long': 'Your lengthy commute consumes significant time that affects work-life balance. Consider relocation or negotiating flexible arrangements if possible.',
+ 'share_wfh_high': 'Your substantial work-from-home arrangement significantly reduces commuting burden and improves quality of life.',
+ 'share_wfh_medium': 'Your partial work-from-home arrangement helps save valuable commuting time.',
+ 'share_shuttle_service_good': 'The company shuttle service is a valuable benefit that makes your commute more comfortable and stress-free.',
+
+ 'share_cbd_environment': 'The CBD office environment offers professional surroundings and convenient access to business services and networking opportunities.',
+ 'share_factory_environment': 'Working in an industrial or outdoor setting presents unique challenges but also develops resilience and practical problem-solving skills.',
+ 'share_normal_environment': 'Your work environment provides the standard amenities needed for productive work without unnecessary distractions.',
+ 'share_leadership_excellent': "Being part of leadership's inner circle offers advantages in terms of opportunities and influence, though it comes with higher expectations.",
+ 'share_leadership_good': 'Your supportive leadership recognizes your contributions and provides the guidance needed for success - a valuable workplace asset.',
+ 'share_leadership_normal': 'Your professional relationship with leadership is straightforward and functional - clear expectations without unnecessary complications.',
+ 'share_leadership_strict': 'Working under strict management can be challenging but often develops discipline and attention to detail that serve you well professionally.',
+ 'share_leadership_bad': 'The tension with leadership creates challenges, requiring careful communication and focusing on deliverables rather than relationships.',
+ 'share_teamwork_excellent': 'The strong personal connections with colleagues creates a supportive network that enhances both work satisfaction and effectiveness.',
+ 'share_teamwork_good': 'Your collaborative team environment fosters mutual support and effective communication, making daily work more pleasant and productive.',
+ 'share_teamwork_normal': 'Maintaining professional but not overly personal relationships with colleagues allows you to focus on your work while having adequate support.',
+ 'share_teamwork_bad': 'The challenging team dynamics require adaptability and self-reliance, which can develop valuable independence and resilience.',
+
+ 'share_workhours_balanced': 'Your balanced work schedule allows sufficient time for personal life, contributing to sustainable long-term performance.',
+ 'share_workhours_long': 'Your extended work hours are manageable but require attention to maintaining energy and preventing burnout.',
+ 'share_workhours_excessive': 'Your work hours are unsustainably long and may impact wellbeing and performance over time. Consider discussing workload adjustments.',
+ 'share_rest_adequate': 'Your generous break time helps maintain energy levels and productivity throughout the workday.',
+ 'share_rest_insufficient': 'Your limited break time suggests a need for incorporating short movement breaks to maintain health and focus.',
+ 'share_leave_abundant': 'Your generous leave allowance provides ample time for rejuvenation and personal pursuits - essential for sustained motivation.',
+ 'share_leave_limited': 'With limited leave time, strategic planning of your days off becomes important for maximizing their restorative benefit.',
+
+ 'share_phd_comment': 'Your doctoral qualification opens doors to specialized positions and demonstrates advanced research and analytical capabilities.',
+ 'share_masters_comment': "Your master's degree demonstrates advanced knowledge and commitment that remains valuable in today's competitive job market.",
+ 'share_bachelor_comment': "Your bachelor's degree provides a solid foundation that, combined with practical experience, enables diverse career opportunities.",
+ 'share_below_bachelor_comment': "While formal education below bachelor's level may present challenges in some fields, practical skills and experience can be equally valuable assets.",
+ 'share_fresh_graduate_comment': 'As a recent graduate, your fresh perspective and current knowledge are assets, balanced by the unlimited potential for growth and learning.',
+ 'share_experienced_comment': 'Your substantial work experience provides valuable context and judgment that enhance your effectiveness and confidence.',
+ 'share_mid_career_comment': 'With several years of experience, you understand both your industry and personal strengths, positioning you for strategic career development.',
+ 'share_government_job_comment': 'The stability of public sector employment reduces career uncertainty, allowing more confident long-term planning.',
+ 'share_private_job_comment': 'While private sector employment carries some uncertainty, it often provides accelerated growth and compensation opportunities.',
+
+ 'share_salary_high_cny': 'Your daily compensation is competitive, providing financial security and flexibility for both necessities and discretionary spending.',
+ 'share_salary_medium_cny': 'Your compensation meets basic needs comfortably but requires thoughtful budgeting for optimal financial health.',
+ 'share_salary_low_cny': 'Your current compensation level necessitates careful financial management while you explore opportunities for income growth.',
+ 'share_salary_high_foreign': 'Your daily compensation is competitive, providing financial security and flexibility for both necessities and discretionary spending.',
+ 'share_salary_medium_foreign': 'Your compensation meets basic needs comfortably but requires thoughtful budgeting for optimal financial health.',
+ 'share_salary_low_foreign': 'Your current compensation level necessitates careful financial management while you explore opportunities for income growth.',
+ 'share_high_cost_city': 'In a high-cost location, careful financial planning helps maximize the value of your compensation.',
+ 'share_low_cost_city': 'In a lower-cost area, your compensation provides enhanced purchasing power and potential for savings.',
+
+ 'share_value_low': 'While the current position shows limited value, it may provide necessary experience for future growth. Extract learning from every aspect while preparing for your next career move.',
+ 'share_value_medium': 'Your job offers balanced value with both strengths and areas for improvement. Focus on leveraging the positive aspects while developing strategies to address the challenges.',
+ 'share_value_high': "You've found a high-value position worth maintaining and developing. Continue building on your strengths and appreciate the satisfaction this role provides.",
+ 'share_summary_advice': 'Overall Recommendation',
+
+ // Ratings
+ 'rating_enter_salary': 'Please enter salary',
+ 'rating_terrible': 'Dismal',
+ 'rating_poor': 'Poor',
+ 'rating_average': 'Average',
+ 'rating_good': 'Good',
+ 'rating_great': 'Great',
+ 'rating_excellent': 'Excellent',
+ 'rating_perfect': 'Outstanding',
+ 'share_country': 'Work Country/Region',
+ }
+};
+
+// 提供上下文的组件
+export const LanguageProvider: React.FC<{children: ReactNode}> = ({ children }) => {
+ // 从本地存储初始化语言,默认为中文
+ const [language, setLanguageState] = useState('zh');
+
+ // 首次渲染时检查本地存储的语言设置
+ useEffect(() => {
+ const savedLanguage = localStorage.getItem('language') as Language;
+ if (savedLanguage && (savedLanguage === 'zh' || savedLanguage === 'en')) {
+ setLanguageState(savedLanguage);
+ }
+ }, []);
+
+ // 设置语言并保存到本地存储
+ const setLanguage = (newLanguage: Language) => {
+ setLanguageState(newLanguage);
+ localStorage.setItem('language', newLanguage);
+ };
+
+ // 翻译函数
+ const t = (key: string): string => {
+ return translations[language][key] || key;
+ };
+
+ return (
+
+ {children}
+
+ );
+};
+
+// 使用上下文的钩子
+export const useLanguage = () => useContext(LanguageContext);
\ No newline at end of file
diff --git a/components/LanguageSwitcher.tsx b/components/LanguageSwitcher.tsx
new file mode 100644
index 0000000..048ca42
--- /dev/null
+++ b/components/LanguageSwitcher.tsx
@@ -0,0 +1,33 @@
+"use client";
+
+import React from 'react';
+import { useLanguage } from './LanguageContext';
+
+export const LanguageSwitcher: React.FC = () => {
+ const { language, setLanguage } = useLanguage();
+
+ return (
+
+
+
+
+ );
+};
\ No newline at end of file
diff --git a/components/ShareCard.tsx b/components/ShareCard.tsx
index 6e479d9..765b2c2 100644
--- a/components/ShareCard.tsx
+++ b/components/ShareCard.tsx
@@ -4,6 +4,7 @@ import React, { useRef, useState, useEffect } from 'react';
import { ArrowLeft, Download } from 'lucide-react';
import html2canvas from 'html2canvas';
import Link from 'next/link';
+import { useLanguage } from './LanguageContext';
// 扩展接口,支持更多属性
interface ShareCardProps {
@@ -16,8 +17,10 @@ interface ShareCardProps {
commuteHours: string;
restTime: string;
dailySalary: string;
- isYuan: boolean;
+ isYuan: string;
workDaysPerYear: string;
+ countryCode: string;
+ countryName: string;
// 详细工作信息
workDaysPerWeek: string;
@@ -43,6 +46,21 @@ interface ShareCardProps {
jobStability: string;
}
+// 将中文评级转换为翻译键
+const getAssessmentKey = (assessment: string): string => {
+ switch (assessment) {
+ case '惨绝人寰': return 'rating_terrible';
+ case '略惨': return 'rating_poor';
+ case '一般': return 'rating_average';
+ case '还不错': return 'rating_good';
+ case '很爽': return 'rating_great';
+ case '爽到爆炸': return 'rating_excellent';
+ case '人生巅峰': return 'rating_perfect';
+ case '请输入年薪': return 'rating_enter_salary';
+ default: return assessment;
+ }
+};
+
// 获取CSS颜色代码
const getColorFromClassName = (className: string): string => {
switch(className) {
@@ -58,93 +76,93 @@ const getColorFromClassName = (className: string): string => {
};
// 获取城市名称
-const getCityName = (cityFactor: string): string => {
- if (cityFactor === '0.70') return "一线城市";
- else if (cityFactor === '0.80') return "新一线城市";
- else if (cityFactor === '1.0') return "二线城市";
- else if (cityFactor === '1.10') return "三线城市";
- else if (cityFactor === '1.25') return "四线城市";
- else if (cityFactor === '1.40') return "县城";
- else if (cityFactor === '1.50') return "乡镇";
- return "三线城市"; // 默认值
+const getCityName = (cityFactor: string, t: (key: string) => string): string => {
+ if (cityFactor === '0.70') return t('city_tier1');
+ else if (cityFactor === '0.80') return t('city_newtier1');
+ else if (cityFactor === '1.0') return t('city_tier2');
+ else if (cityFactor === '1.10') return t('city_tier3');
+ else if (cityFactor === '1.25') return t('city_tier4');
+ else if (cityFactor === '1.40') return t('city_county');
+ else if (cityFactor === '1.50') return t('city_town');
+ return t('city_tier3'); // 默认值
};
// 获取工作环境描述
-const getWorkEnvironmentDesc = (env: string): string => {
- if (env === '0.8') return "偏僻的工厂/工地/户外";
- else if (env === '0.9') return "工厂/工地/户外";
- else if (env === '1.0') return "普通环境";
- else if (env === '1.1') return "CBD";
- return "普通环境";
+const getWorkEnvironmentDesc = (env: string, t: (key: string) => string): string => {
+ if (env === '0.8') return t('env_remote');
+ else if (env === '0.9') return t('env_factory');
+ else if (env === '1.0') return t('env_normal');
+ else if (env === '1.1') return t('env_cbd');
+ return t('env_normal');
};
// 获取领导评价
-const getLeadershipDesc = (rating: string): string => {
- if (rating === '0.7') return "对我不爽";
- else if (rating === '0.9') return "管理严格";
- else if (rating === '1.0') return "中规中矩";
- else if (rating === '1.1') return "善解人意";
- else if (rating === '1.3') return "我是嫡系";
- return "中规中矩";
+const getLeadershipDesc = (rating: string, t: (key: string) => string): string => {
+ if (rating === '0.7') return t('leader_bad');
+ else if (rating === '0.9') return t('leader_strict');
+ else if (rating === '1.0') return t('leader_normal');
+ else if (rating === '1.1') return t('leader_good');
+ else if (rating === '1.3') return t('leader_favorite');
+ return t('leader_normal');
};
// 获取同事环境评价
-const getTeamworkDesc = (rating: string): string => {
- if (rating === '0.9') return "都是傻逼";
- else if (rating === '1.0') return "萍水相逢";
- else if (rating === '1.1') return "和和睦睦";
- else if (rating === '1.2') return "私交甚好";
- return "萍水相逢";
+const getTeamworkDesc = (rating: string, t: (key: string) => string): string => {
+ if (rating === '0.9') return t('team_bad');
+ else if (rating === '1.0') return t('team_normal');
+ else if (rating === '1.1') return t('team_good');
+ else if (rating === '1.2') return t('team_excellent');
+ return t('team_normal');
};
// 获取班车服务描述
-const getShuttleDesc = (shuttle: string): string => {
- if (shuttle === '1.0') return "无班车";
- else if (shuttle === '0.9') return "班车不便";
- else if (shuttle === '0.7') return "便利班车";
- else if (shuttle === '0.5') return "班车直达";
- return "无班车";
+const getShuttleDesc = (shuttle: string, t: (key: string) => string): string => {
+ if (shuttle === '1.0') return t('shuttle_none');
+ else if (shuttle === '0.9') return t('shuttle_inconvenient');
+ else if (shuttle === '0.7') return t('shuttle_convenient');
+ else if (shuttle === '0.5') return t('shuttle_direct');
+ return t('shuttle_none');
};
// 获取食堂情况描述
-const getCanteenDesc = (canteen: string): string => {
- if (canteen === '1.0') return "无食堂/很难吃";
- else if (canteen === '1.05') return "食堂一般";
- else if (canteen === '1.1') return "食堂不错";
- else if (canteen === '1.15') return "食堂超赞";
- return "无食堂/很难吃";
+const getCanteenDesc = (canteen: string, t: (key: string) => string): string => {
+ if (canteen === '1.0') return t('canteen_none');
+ else if (canteen === '1.05') return t('canteen_average');
+ else if (canteen === '1.1') return t('canteen_good');
+ else if (canteen === '1.15') return t('canteen_excellent');
+ return t('canteen_none');
};
// 获取合同类型描述
-const getJobStabilityDesc = (type: string): string => {
- if (type === 'private') return "私企续签";
- else if (type === 'foreign') return "外企续签";
- else if (type === 'state') return "长期雇佣";
- else if (type === 'government') return "永久编制";
- return "私企续签";
+const getJobStabilityDesc = (type: string, t: (key: string) => string): string => {
+ if (type === 'private') return t('job_private');
+ else if (type === 'foreign') return t('job_foreign');
+ else if (type === 'state') return t('job_state');
+ else if (type === 'government') return t('job_government');
+ return t('job_private');
};
// 获取学历描述
-const getDegreeDesc = (type: string): string => {
- if (type === 'belowBachelor') return "专科及以下";
- else if (type === 'bachelor') return "本科";
- else if (type === 'masters') return "硕士";
- else if (type === 'phd') return "博士";
- return "本科";
+const getDegreeDesc = (type: string, t: (key: string) => string): string => {
+ if (type === 'belowBachelor') return t('below_bachelor');
+ else if (type === 'bachelor') return t('bachelor');
+ else if (type === 'masters') return t('masters');
+ else if (type === 'phd') return t('phd');
+ return t('bachelor');
};
// 获取学校类型描述
-const getSchoolTypeDesc = (type: string, degree: string): string => {
- if (type === 'secondTier') return "二本三本";
+const getSchoolTypeDesc = (type: string, degree: string, t: (key: string) => string): string => {
+ if (type === 'secondTier') return t('school_second_tier');
else if (type === 'firstTier') {
- if (degree === 'bachelor') return "双非/ QS200/ USnews80";
- return "双非/ QS100/ USnews50";
+ if (degree === 'bachelor') return t('school_first_tier_bachelor');
+ return t('school_first_tier_higher');
}
else if (type === 'elite') {
- if (degree === 'bachelor') return "985211/ QS50/ USnews30";
- return "985211/ QS30/ USnews20";
+ if (degree === 'bachelor') return t('school_elite_bachelor');
+ return t('school_elite_higher');
}
- return "双非";
+ return t('school_first_tier_bachelor');
};
// 获取emoji表情
@@ -159,306 +177,15 @@ const getEmoji = (value: number): string => {
};
// 获取工作年限描述
-const getWorkYearsDesc = (years: string): string => {
- if (years === '0') return "应届生";
- else if (years === '1') return "1-3年";
- else if (years === '2') return "3-5年";
- else if (years === '4') return "5-8年";
- else if (years === '6') return "8-10年";
- else if (years === '10') return "10-12年";
- else if (years === '15') return "12年以上";
- return "应届生";
-};
-
-// 根据工作内容和选择生成个性化评价
-const generatePersonalizedComments = (props: ShareCardProps) => {
- const comments = [];
- const valueNum = parseFloat(props.value);
-
- // 1. 根据总体性价比生成主评价
- let mainComment = "";
- if (valueNum < 0.6) {
- mainComment = "这份工作对你来说简直是一场噩梦,每一天都是艰难的挑战。";
- } else if (valueNum < 1.0) {
- mainComment = "这份工作让你疲惫不堪,但或许是通往更好未来的必经之路。";
- } else if (valueNum <= 1.8) {
- mainComment = "这份工作平平淡淡,既没有太多惊喜,也没有太多失望。";
- } else if (valueNum <= 2.5) {
- mainComment = "这份工作给你带来了不少成就感,是一份令人满意的选择。";
- } else if (valueNum <= 3.2) {
- mainComment = "这份工作几乎满足了你的所有期望,每天都充满干劲。";
- } else if (valueNum <= 4.0) {
- mainComment = "这份工作简直是为你量身定做的,既有挑战又有回报,令你心满意足。";
- } else {
- mainComment = "恭喜你找到了人生中的理想工作,这样的机会可遇而不可求!";
- }
- comments.push({
- title: "整体评价",
- content: mainComment,
- emoji: getEmoji(valueNum),
- details: [
- { label: "总体得分", value: `${props.value} (${props.assessment})` }
- ]
- });
-
- // 2. 工作城市评价
- const cityName = getCityName(props.cityFactor);
- const isHomeTown = props.homeTown === 'yes';
- let cityComment = "";
- if (isHomeTown) {
- cityComment = `在家乡工作,让你既能追求事业,又能照顾家人,平衡感满满。家的温暖和熟悉的环境给你带来额外的安全感和幸福感。`;
- } else {
- if (props.cityFactor === '0.70' || props.cityFactor === '0.80') {
- cityComment = `虽然生活成本较高,但丰富的机会和广阔的平台能够助你更快成长。`;
- } else if (props.cityFactor === '1.0' || props.cityFactor === '1.10') {
- cityComment = `生活节奏虽然没有一线城市那么快,但依然提供了不错的发展空间。这里的生活压力适中,让你能找到工作与生活之间的平衡。`;
- } else {
- cityComment = `你享受着低成本高质量的生活。虽然机会相对较少,但悠闲的生活节奏和较低的压力让你能更从容地面对人生。`;
- }
- cityComment += " 要照顾好自己,按时吃饭休息,你一个人去得那么远。";
- }
- comments.push({
- title: "城市选择",
- content: cityComment,
- emoji: isHomeTown ? "🏡" : "🌆",
- details: [
- { label: "所在城市", value: cityName },
- { label: "是否家乡", value: isHomeTown ? "是" : "否" }
- ]
- });
-
- // 3. 通勤与WFH评价
- const commuteHoursNum = parseFloat(props.commuteHours);
- const wfhDaysNum = parseFloat(props.wfhDaysPerWeek);
- const workDaysNum = parseFloat(props.workDaysPerWeek);
- const wfhRatio = workDaysNum > 0 ? (wfhDaysNum / workDaysNum) : 0;
- let commuteComment = "";
-
- if (commuteHoursNum <= 1) {
- commuteComment = "你的通勤时间很短,让你每天都能多出宝贵的时间用于自我提升或休息。";
- } else if (commuteHoursNum <= 2) {
- commuteComment = "你的通勤时间适中,不会让你感到太大压力,也可以利用这段时间听书或补觉。";
- } else {
- commuteComment = "你长时间的通勤占用了大量宝贵时间,会对身心健康造成一定影响,建议考虑搬家或换工作以改善。";
- }
-
- if (wfhRatio >= 0.6) {
- commuteComment += " 而且你有大量居家办公的机会,进一步减轻了通勤负担,提高了工作生活质量。";
- } else if (wfhRatio >= 0.2) {
- commuteComment += " 你的部分居家办公安排也为你节省了不少通勤时间。";
- }
-
- if (props.shuttle === '0.7' || props.shuttle === '0.5') {
- commuteComment += " 公司提供的便利班车服务是一个不小的福利,让你的通勤更轻松愉快。";
- }
-
- comments.push({
- title: "通勤体验",
- content: commuteComment,
- emoji: wfhRatio >= 0.5 ? "🏠" : "🚌",
- details: [
- { label: "通勤时间", value: `${props.commuteHours} 小时/天` },
- { label: "远程办公", value: `${props.wfhDaysPerWeek}/${props.workDaysPerWeek} 天/周 (${Math.round(wfhRatio * 100)}%)` },
- { label: "班车服务", value: getShuttleDesc(props.shuttle) }
- ]
- });
-
- // 4. 工作环境与人际关系评价
- const leadershipRating = props.leadership;
- const teamworkRating = props.teamwork;
- const workEnvironment = props.workEnvironment;
-
- let environmentComment = "";
-
- if (workEnvironment === '1.1') {
- environmentComment = "在CBD的办公环境既专业又现代化,提供了良好的职业形象和便利的工作条件。";
- } else if (workEnvironment === '0.8' || workEnvironment === '0.9') {
- environmentComment = "在工厂/户外环境工作确实有些挑战,但也培养了你的坚韧品质和适应能力。";
- } else {
- environmentComment = "你的工作环境舒适适中,能满足基本需求,为高效工作提供了足够的保障。";
- }
-
- // 更细致的领导关系评价
- if (leadershipRating === '1.3') {
- environmentComment += " 你享受着作为嫡系的优越待遇和发展机会,但也面临着更高的期望和责任。";
- } else if (leadershipRating === '1.1') {
- environmentComment += " 你的领导能够理解你的工作状态并提供必要的支持,这在职场中非常难得。";
- } else if (leadershipRating === '1.0') {
- environmentComment += " 你和领导各司其职,这种关系虽然普通但稳定可靠。";
- } else if (leadershipRating === '0.9') {
- environmentComment += " 你领导的管理风格较为严格,这种严格虽然有时让人压力大,但也能促使你更加专业和自律。";
- } else if (leadershipRating === '0.7') {
- environmentComment += " 你与领导之间的关系有些紧张,这种情况下要学会保持情绪稳定,专注于工作本身,同时提升自己的沟通技巧。";
- }
-
- // 更细致的同事关系评价
- if (teamworkRating === '1.2') {
- environmentComment += " 你与同事们建立了深厚的私人友谊,工作之余还能互相支持和陪伴,这种关系让职场生活更加充实和有意义。";
- } else if (teamworkRating === '1.1') {
- environmentComment += " 团队氛围和谐友善,同事之间相互尊重和支持,这种积极的人际环境让工作过程更加愉快和高效。";
- } else if (teamworkRating === '1.0') {
- environmentComment += " 与同事们相处和平但不过分亲近,这种关系模式适合专注于工作的职场人士。";
- } else if (teamworkRating === '0.9') {
- environmentComment += " 同事关系略显紧张,这种环境虽然不太舒适,但也锻炼了你的独立工作能力和心理承受力。";
- }
-
- comments.push({
- title: "职场环境",
- content: environmentComment,
- emoji: "🏢",
- details: [
- { label: "办公环境", value: getWorkEnvironmentDesc(workEnvironment) },
- { label: "领导关系", value: getLeadershipDesc(leadershipRating) },
- { label: "同事氛围", value: getTeamworkDesc(teamworkRating) },
- { label: "食堂情况", value: getCanteenDesc(props.canteen) }
- ]
- });
-
- // 5. 工作时间与强度评价
- const workHoursNum = parseFloat(props.workHours);
- const restTimeNum = parseFloat(props.restTime);
- const effectiveWorkTime = workHoursNum + parseFloat(props.commuteHours) - 0.5 * restTimeNum;
-
- let workTimeComment = "";
- if (effectiveWorkTime <= 8) {
- workTimeComment = "你的工作强度适中,有足够的时间照顾个人生活,保持着良好的工作生活平衡。";
- } else if (effectiveWorkTime <= 11) {
- workTimeComment = "你的工作时间略长,但仍在可接受范围内。注意合理安排休息时间,避免长期疲劳。";
- } else {
- workTimeComment = "你的工作时间过长,长期如此可能影响健康和生活质量。建议寻找方法提高效率或与上级商量调整工作安排。";
- }
-
- if (restTimeNum >= 2.5) {
- workTimeComment += " 你有充足的休息和午休时间,这有助于恢复精力,提高下午的工作效率。";
- } else if (restTimeNum <= 1) {
- workTimeComment += " 你的休息时间较少,记得定期起身活动,防止久坐带来的健康问题。";
- }
-
- const annualLeaveNum = parseFloat(props.annualLeave);
- if (annualLeaveNum >= 15) {
- workTimeComment += " 丰富的年假让你有充分的时间休整和旅行,这对维持长期工作动力非常重要。";
- } else if (annualLeaveNum <= 5) {
- workTimeComment += " 你的年假较少,可以考虑更有效地规划和利用这些宝贵的休假时间。";
- }
-
- const totalLeave = parseFloat(props.annualLeave) + parseFloat(props.publicHolidays) + parseFloat(props.paidSickLeave) * 0.6;
-
- comments.push({
- title: "工作节奏",
- content: workTimeComment,
- emoji: "⏱️",
- details: [
- { label: "工作时长", value: `${props.workHours} 小时/天` },
- { label: "有效工作时间", value: `${effectiveWorkTime.toFixed(1)} 小时/天` },
- { label: "午休与摸鱼", value: `${props.restTime} 小时/天` },
- { label: "年假天数", value: `${props.annualLeave} 天/年` },
- { label: "带薪病假", value: `${props.paidSickLeave} 天/年` },
- { label: "法定假日", value: `${props.publicHolidays} 天/年` },
- { label: "总休假时间", value: `${totalLeave.toFixed(1)} 天/年` }
- ]
- });
-
- // 6. 教育背景与职业发展评价
- const degreeType = props.degreeType;
- const workYears = props.workYears;
- const jobStability = props.jobStability;
-
- let careerComment = "";
- if (degreeType === 'phd') {
- careerComment = "博士学历是你职场的一张重要名片,为你打开了许多高端研究和专业岗位的大门。";
- } else if (degreeType === 'masters') {
- careerComment = "硕士学历在当今就业市场仍有一定优势,证明了你的学习能力和专业素养。";
- } else if (degreeType === 'bachelor') {
- careerComment = "本科学历为你的职业生涯奠定了坚实基础,结合实际经验,你能在各个领域找到发展机会。";
- } else {
- careerComment = "专科及以下学历虽然在某些领域可能面临挑战,但实践经验和专业技能同样能帮你赢得认可。";
- }
-
- if (workYears === '0') {
- careerComment += " 作为应届生,你充满朝气和学习热情,有无限的可能性去探索和成长。";
- } else if (parseInt(workYears) >= 6) {
- careerComment += " 多年的工作经验是你最宝贵的财富,让你在职场中更加从容和自信。";
- } else {
- careerComment += " 几年的工作经验让你更加了解行业和自己的优势,职业发展正处于上升期。";
- }
-
- if (jobStability === 'government') {
- careerComment += " 体制内的工作稳定性高,让你无需过多担忧失业风险,可以更从容地规划未来。";
- } else if (jobStability === 'private') {
- careerComment += " 私企的工作虽然有一定风险,但也提供了更多成长和收入提升的机会。";
- }
-
- comments.push({
- title: "职业发展",
- content: careerComment,
- emoji: "📚",
- details: [
- { label: "最高学历", value: getDegreeDesc(degreeType) },
- { label: "学校类型", value: getSchoolTypeDesc(props.schoolType, degreeType) },
- { label: "工作年限", value: getWorkYearsDesc(workYears) },
- { label: "合同类型", value: getJobStabilityDesc(jobStability) }
- ]
- });
-
- // 7. 薪资评价
- const dailySalary = props.dailySalary;
- const isYuan = props.isYuan;
-
- let salaryComment = "";
- const salaryNumeric = parseFloat(dailySalary);
- if (isYuan) {
- if (salaryNumeric >= 1000) {
- salaryComment = "你的日薪处于较高水平,财务状况良好,能够满足日常生活和一定的休闲娱乐需求。";
- } else if (salaryNumeric >= 500) {
- salaryComment = "你的日薪处于中等水平,足以应对基本生活需求,但可能需要更细致的预算规划。";
- } else {
- salaryComment = "你的日薪较低,可能需要精打细算来管理财务,同时寻找提升收入的机会。";
- }
- } else {
- if (salaryNumeric >= 150) {
- salaryComment = "你的日薪处于较高水平,财务状况良好,能够满足日常生活和一定的休闲娱乐需求。";
- } else if (salaryNumeric >= 80) {
- salaryComment = "你的日薪处于中等水平,足以应对基本生活需求,但可能需要更细致的预算规划。";
- } else {
- salaryComment = "你的日薪较低,可能需要精打细算来管理财务,同时寻找提升收入的机会。";
- }
- }
-
- // 考虑城市因素
- if (props.cityFactor === '0.70' || props.cityFactor === '0.80') {
- salaryComment += " 在高生活成本的城市,你的薪资需要更精明地管理才能达到理想的生活质量。";
- } else if (props.cityFactor === '1.25' || props.cityFactor === '1.40' || props.cityFactor === '1.50') {
- salaryComment += " 在低生活成本的地区,你的薪资能够带来更高的生活质量和更多的储蓄机会。";
- }
-
- comments.push({
- title: "薪资水平",
- content: salaryComment,
- emoji: "💰",
- details: [
- { label: "日薪", value: `${isYuan ? '¥' : '$'}${dailySalary}/天` },
- { label: "年工作天数", value: `${props.workDaysPerYear} 天` }
- ]
- });
-
- // 8. 总结性价比评价
- let valueComment = "";
- if (valueNum < 1.0) {
- valueComment = "虽然目前的工作性价比较低,但这可能是积累经验的必经阶段。记住每份工作都有其价值,努力汲取经验,为下一步发展打好基础。";
- } else if (valueNum <= 2.0) {
- valueComment = "你的工作性价比处于中等水平,有优点也有不足。可以专注于现有优势,同时寻找提升不足方面的方法,让工作体验更加全面。";
- } else {
- valueComment = "恭喜你拥有高性价比的工作!这样的机会难得,要珍惜现在的环境,继续发挥自己的优势,享受工作带来的成就感和满足感。";
- }
-
- comments.push({
- title: "综合建议",
- content: valueComment,
- emoji: "💎",
- details: []
- });
-
- return comments;
+const getWorkYearsDesc = (years: string, t: (key: string) => string): string => {
+ if (years === '0') return t('fresh_graduate');
+ else if (years === '1') return t('years_1_3');
+ else if (years === '2') return t('years_3_5');
+ else if (years === '4') return t('years_5_8');
+ else if (years === '6') return t('years_8_10');
+ else if (years === '10') return t('years_10_12');
+ else if (years === '15') return t('years_above_12');
+ return t('fresh_graduate');
};
const ShareCard: React.FC = (props) => {
@@ -466,6 +193,7 @@ const ShareCard: React.FC = (props) => {
const simpleReportRef = useRef(null); // 添加简化版报告的引用
const [isDownloading, setIsDownloading] = useState(false);
const [fadeIn, setFadeIn] = useState(false);
+ const { t, language } = useLanguage();
// 页面载入动画效果
useEffect(() => {
@@ -473,7 +201,295 @@ const ShareCard: React.FC = (props) => {
}, []);
// 生成个性化评价
- const personalizedComments = generatePersonalizedComments(props);
+ const personalizedComments = (() => {
+ const comments = [];
+ const valueNum = parseFloat(props.value);
+
+ // 1. 根据总体性价比生成主评价
+ let mainComment = "";
+ if (valueNum < 0.6) {
+ mainComment = t('share_low_value_assessment_1');
+ } else if (valueNum < 1.0) {
+ mainComment = t('share_low_value_assessment_2');
+ } else if (valueNum <= 1.8) {
+ mainComment = t('share_medium_value_assessment_1');
+ } else if (valueNum <= 2.5) {
+ mainComment = t('share_medium_value_assessment_2');
+ } else if (valueNum <= 3.2) {
+ mainComment = t('share_high_value_assessment_1');
+ } else if (valueNum <= 4.0) {
+ mainComment = t('share_high_value_assessment_2');
+ } else {
+ mainComment = t('share_high_value_assessment_3');
+ }
+ comments.push({
+ title: t('share_final_assessment'),
+ content: mainComment,
+ emoji: getEmoji(valueNum),
+ details: [
+ { label: t('share_final_assessment'), value: `${props.value} (${t(getAssessmentKey(props.assessment))})` }
+ ]
+ });
+
+ // 2. 工作城市评价
+ const cityName = getCityName(props.cityFactor, t);
+ const isHomeTown = props.homeTown === 'yes';
+ let cityComment = "";
+ if (isHomeTown) {
+ cityComment = t('share_hometown_comment');
+ } else {
+ if (props.cityFactor === '0.70' || props.cityFactor === '0.80') {
+ cityComment = t('share_tier1_city_comment');
+ } else if (props.cityFactor === '1.0' || props.cityFactor === '1.10') {
+ cityComment = t('share_tier2_city_comment');
+ } else {
+ cityComment = t('share_tier3_city_comment');
+ }
+ }
+ comments.push({
+ title: t('share_work_city'),
+ content: cityComment,
+ emoji: isHomeTown ? "🏡" : "🌆",
+ details: [
+ { label: t('share_work_city'), value: cityName },
+ { label: t('share_is_hometown'), value: isHomeTown ? t('share_yes') : t('share_no') },
+ { label: t('share_country'), value: props.countryName }
+ ]
+ });
+
+ // 3. 通勤与WFH评价
+ const commuteHoursNum = parseFloat(props.commuteHours);
+ const wfhDaysNum = parseFloat(props.wfhDaysPerWeek);
+ const workDaysNum = parseFloat(props.workDaysPerWeek);
+ const wfhRatio = workDaysNum > 0 ? (wfhDaysNum / workDaysNum) : 0;
+
+ let commuteComment = "";
+
+ if (commuteHoursNum <= 1) {
+ commuteComment = t('share_commute_short');
+ } else if (commuteHoursNum <= 2) {
+ commuteComment = t('share_commute_medium');
+ } else {
+ commuteComment = t('share_commute_long');
+ }
+
+ if (wfhRatio >= 0.6) {
+ commuteComment += " " + t('share_wfh_high');
+ } else if (wfhRatio >= 0.2) {
+ commuteComment += " " + t('share_wfh_medium');
+ }
+
+ if (props.shuttle === '0.7' || props.shuttle === '0.5') {
+ commuteComment += " " + t('share_shuttle_service_good');
+ }
+
+ comments.push({
+ title: t('share_daily_commute_hours'),
+ content: commuteComment,
+ emoji: wfhRatio >= 0.5 ? "🏠" : "🚌",
+ details: [
+ { label: t('share_daily_commute_hours'), value: `${props.commuteHours} ${t('share_hours')}` },
+ { label: t('share_remote_work'), value: `${props.wfhDaysPerWeek}/${props.workDaysPerWeek} ${t('share_days_per_week')} (${Math.round(wfhRatio * 100)}%)` },
+ { label: t('share_shuttle_service'), value: getShuttleDesc(props.shuttle, t) }
+ ]
+ });
+
+ // 4. 工作环境与人际关系评价
+ const leadershipRating = props.leadership;
+ const teamworkRating = props.teamwork;
+ const workEnvironment = props.workEnvironment;
+
+ let environmentComment = "";
+
+ if (workEnvironment === '1.1') {
+ environmentComment = t('share_cbd_environment');
+ } else if (workEnvironment === '0.8' || workEnvironment === '0.9') {
+ environmentComment = t('share_factory_environment');
+ } else {
+ environmentComment = t('share_normal_environment');
+ }
+
+ // 更细致的领导关系评价
+ if (leadershipRating === '1.3') {
+ environmentComment += " " + t('share_leadership_excellent');
+ } else if (leadershipRating === '1.1') {
+ environmentComment += " " + t('share_leadership_good');
+ } else if (leadershipRating === '1.0') {
+ environmentComment += " " + t('share_leadership_normal');
+ } else if (leadershipRating === '0.9') {
+ environmentComment += " " + t('share_leadership_strict');
+ } else if (leadershipRating === '0.7') {
+ environmentComment += " " + t('share_leadership_bad');
+ }
+
+ // 更细致的同事关系评价
+ if (teamworkRating === '1.2') {
+ environmentComment += " " + t('share_teamwork_excellent');
+ } else if (teamworkRating === '1.1') {
+ environmentComment += " " + t('share_teamwork_good');
+ } else if (teamworkRating === '1.0') {
+ environmentComment += " " + t('share_teamwork_normal');
+ } else if (teamworkRating === '0.9') {
+ environmentComment += " " + t('share_teamwork_bad');
+ }
+
+ comments.push({
+ title: t('share_work_environment_title'),
+ content: environmentComment,
+ emoji: "🏢",
+ details: [
+ { label: t('share_office_environment'), value: getWorkEnvironmentDesc(workEnvironment, t) },
+ { label: t('share_leadership_relation'), value: getLeadershipDesc(leadershipRating, t) },
+ { label: t('share_colleague_relationship'), value: getTeamworkDesc(teamworkRating, t) },
+ { label: t('share_canteen_quality'), value: getCanteenDesc(props.canteen, t) }
+ ]
+ });
+
+ // 5. 工作时间与强度评价
+ const workHoursNum = parseFloat(props.workHours);
+ const restTimeNum = parseFloat(props.restTime);
+ const effectiveWorkTime = workHoursNum + parseFloat(props.commuteHours) - 0.5 * restTimeNum;
+
+ let workTimeComment = "";
+ if (effectiveWorkTime <= 8) {
+ workTimeComment = t('share_workhours_balanced');
+ } else if (effectiveWorkTime <= 11) {
+ workTimeComment = t('share_workhours_long');
+ } else {
+ workTimeComment = t('share_workhours_excessive');
+ }
+
+ if (restTimeNum >= 2.5) {
+ workTimeComment += " " + t('share_rest_adequate');
+ } else if (restTimeNum <= 1) {
+ workTimeComment += " " + t('share_rest_insufficient');
+ }
+
+ const annualLeaveNum = parseFloat(props.annualLeave);
+ if (annualLeaveNum >= 15) {
+ workTimeComment += " " + t('share_leave_abundant');
+ } else if (annualLeaveNum <= 5) {
+ workTimeComment += " " + t('share_leave_limited');
+ }
+
+ const totalLeave = parseFloat(props.annualLeave) + parseFloat(props.publicHolidays) + parseFloat(props.paidSickLeave) * 0.6;
+
+ comments.push({
+ title: t('share_work_hours_title'),
+ content: workTimeComment,
+ emoji: "⏱️",
+ details: [
+ { label: t('work_hours'), value: `${props.workHours} ${t('share_hours')}` },
+ { label: t('share_daily_work_hours'), value: `${effectiveWorkTime.toFixed(1)} ${t('share_hours')}` },
+ { label: t('rest_time'), value: `${props.restTime} ${t('share_hours')}` },
+ { label: t('annual_leave'), value: `${props.annualLeave} ${t('share_days_per_year')}` },
+ { label: t('paid_sick_leave'), value: `${props.paidSickLeave} ${t('share_days_per_year')}` },
+ { label: t('public_holidays'), value: `${props.publicHolidays} ${t('share_days_per_year')}` }
+ ]
+ });
+
+ // 6. 教育背景与职业发展评价
+ const degreeType = props.degreeType;
+ const workYears = props.workYears;
+ const jobStability = props.jobStability;
+
+ let careerComment = "";
+ if (degreeType === 'phd') {
+ careerComment = t('share_phd_comment');
+ } else if (degreeType === 'masters') {
+ careerComment = t('share_masters_comment');
+ } else if (degreeType === 'bachelor') {
+ careerComment = t('share_bachelor_comment');
+ } else {
+ careerComment = t('share_below_bachelor_comment');
+ }
+
+ if (workYears === '0') {
+ careerComment += " " + t('share_fresh_graduate_comment');
+ } else if (parseInt(workYears) >= 6) {
+ careerComment += " " + t('share_experienced_comment');
+ } else {
+ careerComment += " " + t('share_mid_career_comment');
+ }
+
+ if (jobStability === 'government') {
+ careerComment += " " + t('share_government_job_comment');
+ } else if (jobStability === 'private') {
+ careerComment += " " + t('share_private_job_comment');
+ }
+
+ comments.push({
+ title: t('share_education_and_experience'),
+ content: careerComment,
+ emoji: "📚",
+ details: [
+ { label: t('share_highest_degree'), value: getDegreeDesc(degreeType, t) },
+ { label: t('share_school_type_label'), value: getSchoolTypeDesc(props.schoolType, degreeType, t) },
+ { label: t('share_work_years_label'), value: getWorkYearsDesc(workYears, t) },
+ { label: t('share_contract_type_label'), value: getJobStabilityDesc(jobStability, t) }
+ ]
+ });
+
+ // 7. 薪资评价
+ const dailySalary = props.dailySalary;
+ const isYuan = props.isYuan === 'true';
+
+ let salaryComment = "";
+ const salaryNumeric = parseFloat(dailySalary);
+ if (isYuan) {
+ if (salaryNumeric >= 1000) {
+ salaryComment = t('share_salary_high_cny');
+ } else if (salaryNumeric >= 500) {
+ salaryComment = t('share_salary_medium_cny');
+ } else {
+ salaryComment = t('share_salary_low_cny');
+ }
+ } else {
+ if (salaryNumeric >= 150) {
+ salaryComment = t('share_salary_high_foreign');
+ } else if (salaryNumeric >= 80) {
+ salaryComment = t('share_salary_medium_foreign');
+ } else {
+ salaryComment = t('share_salary_low_foreign');
+ }
+ }
+
+ // 考虑城市因素
+ if (props.cityFactor === '0.70' || props.cityFactor === '0.80') {
+ salaryComment += " " + t('share_high_cost_city');
+ } else if (props.cityFactor === '1.25' || props.cityFactor === '1.40' || props.cityFactor === '1.50') {
+ salaryComment += " " + t('share_low_cost_city');
+ }
+
+ comments.push({
+ title: t('share_daily_salary'),
+ content: salaryComment,
+ emoji: "💰",
+ details: [
+ { label: t('share_daily_salary'), value: `${isYuan ? '¥' : '$'}${dailySalary}/${t('share_day')}` },
+ { label: t('share_working_days_per_year'), value: `${props.workDaysPerYear} ${t('share_days')}` }
+ ]
+ });
+
+ // 8. 总结性价比评价
+ let valueComment = "";
+ if (valueNum < 1.0) {
+ valueComment = t('share_value_low');
+ } else if (valueNum <= 2.0) {
+ valueComment = t('share_value_medium');
+ } else {
+ valueComment = t('share_value_high');
+ }
+
+ comments.push({
+ title: t('share_summary_advice'),
+ content: valueComment,
+ emoji: "💎",
+ details: []
+ });
+
+ return comments;
+ })();
// 处理下载图片 - 使用简化版报告
const handleDownload = async () => {
@@ -527,7 +543,7 @@ const ShareCard: React.FC = (props) => {
-
返回计算器
+
{t('share_back_to_calculator')}
@@ -536,13 +552,13 @@ const ShareCard: React.FC = (props) => {
{getEmoji(parseFloat(props.value))}
- 你的工作性价比报告
+ {t('share_your_job_worth_report')}
{props.value}
- {props.assessment}
+ {t(getAssessmentKey(props.assessment))}
@@ -577,7 +593,7 @@ const ShareCard: React.FC = (props) => {
{/* 底部信息 */}
-
由"这b班上得值不值·测算版"精心定制
+
{t('share_custom_made')}
worthjob.zippland.com
@@ -590,159 +606,173 @@ const ShareCard: React.FC