Initial commit: NomadHub digital nomad CRM app.
React 19 + Capacitor Android app with nomadro hub-style UI, interactive globe, people/roster CRM, and settings (disguise, import/export). Co-authored-by: Cursor <cursoragent@cursor.com>
33
.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
.env
|
||||
.env.*
|
||||
|
||||
# Android build
|
||||
android/.gradle
|
||||
android/app/build
|
||||
android/build
|
||||
android/local.properties
|
||||
*.apk
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
8
.oxlintrc.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["react", "typescript", "oxc"],
|
||||
"rules": {
|
||||
"react/rules-of-hooks": "error",
|
||||
"react/only-export-components": ["warn", { "allowConstantExport": true }]
|
||||
}
|
||||
}
|
||||
103
README.md
Normal file
@ -0,0 +1,103 @@
|
||||
# NomadHub · 数字游民人际操作系统
|
||||
|
||||
面向数字游民的 **业务人脉 + 约会管理** 移动端应用。UI/UX 对齐 [nomadro](https://nomadro.cn) hub 风格:深色玻璃拟态、三色渐变(珊瑚 / 金 / 青)、aurora 背景。
|
||||
|
||||
## 功能概览
|
||||
|
||||
### 🌍 地球(首页)
|
||||
- nomadro 同款 **hub-globe**:线框球体、半透明大陆、交叉轨道环、脉冲光点、虚线飞行轨迹
|
||||
- 浮动 **emoji 城市标签**(🏝️ 巴厘岛 / ☕ 里斯本 / 🏔️ 清迈 风格)
|
||||
- 全球 → 国家 → 城市 **三级下钻**,点击标签进入详情
|
||||
- 拖动旋转、滚轮/双指缩放
|
||||
- 业务 / 约会筛选,待跟进提醒面板
|
||||
|
||||
### 👥 人脉
|
||||
- **Tinder 卡片** + 列表双视图,左右滑收藏/拉黑
|
||||
- 多维度筛选:性别、年龄、感情、来源、关系进度、职业、搜索
|
||||
- 收藏 / 待跟进快捷筛选
|
||||
- 添加人脉表单
|
||||
|
||||
### 📋 花名册
|
||||
- **职业库** · **Coffeechat 候选** · **招募助理 / 简历库**
|
||||
- 与人脉相同的高级筛选体系
|
||||
|
||||
### 📇 资料卡(CRM)
|
||||
- 关系漏斗:认识 → 聊天 → 互动 → 见面 → 二次见面 → 稳定关系
|
||||
- 电话 / 微信 / Telegram,备注编辑,聊天日志,标记今日已互动
|
||||
- 星标 / 黑名单
|
||||
|
||||
### ⚙️ 设置
|
||||
- **首页伪装**:计算器界面,PIN 解锁
|
||||
- JSON **导入/导出**(localStorage 持久化)
|
||||
- 黑名单管理、自动互动提醒
|
||||
|
||||
## 技术栈
|
||||
|
||||
| 层 | 技术 |
|
||||
|---|---|
|
||||
| 前端 | React 19 · TypeScript · Vite |
|
||||
| 动画 | Framer Motion |
|
||||
| 样式 | nomadro hub design tokens(CSS 变量 + 玻璃卡片) |
|
||||
| 地球 | SVG/CSS 2D(兼容无 WebGL 环境) |
|
||||
| 移动端 | Capacitor 8 → Android APK |
|
||||
| 存储 | localStorage |
|
||||
|
||||
## 快速开始
|
||||
|
||||
```bash
|
||||
# 安装依赖
|
||||
npm install
|
||||
|
||||
# 开发(浏览器)
|
||||
npm run dev
|
||||
# 默认 http://127.0.0.1:5173
|
||||
|
||||
# 生产构建
|
||||
npm run build
|
||||
```
|
||||
|
||||
## 打包 Android APK
|
||||
|
||||
需要 **Android Studio JBR**(Java 21+):
|
||||
|
||||
```powershell
|
||||
$env:JAVA_HOME = "C:\Program Files\Android\Android Studio\jbr"
|
||||
npm run build
|
||||
npx cap sync android
|
||||
cd android
|
||||
.\gradlew.bat assembleDebug
|
||||
```
|
||||
|
||||
输出路径:`android/app/build/outputs/apk/debug/app-debug.apk`
|
||||
|
||||
或使用快捷脚本:
|
||||
|
||||
```bash
|
||||
npm run apk
|
||||
```
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
src/
|
||||
├── App.tsx # 主壳 + Tab 路由 + 伪装锁屏
|
||||
├── components/
|
||||
│ ├── Globe/Globe2D.tsx # nomadro hub-globe 交互地球
|
||||
│ ├── People/ # Tinder 卡片、添加表单
|
||||
│ ├── ProfileCard/ # 资料卡 overlay
|
||||
│ ├── Filters/ # 高级筛选面板
|
||||
│ └── Layout/ # 导航、aurora 背景、PageHeader
|
||||
├── pages/ # 地球 / 人脉 / 花名册 / 设置
|
||||
├── store/useContacts.ts # 状态、筛选、导入导出、PIN
|
||||
├── types/ # Contact、Filters 类型
|
||||
└── data/mockContacts.ts # 初始 mock 数据
|
||||
```
|
||||
|
||||
## 仓库
|
||||
|
||||
- **Git**: https://git.nomadro.cn/hackrobot/nomadhub
|
||||
- **用户**: `hackrobot`
|
||||
|
||||
## License
|
||||
|
||||
Private · Nomadro internal use
|
||||
101
android/.gitignore
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# Using Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore
|
||||
|
||||
# Built application files
|
||||
*.apk
|
||||
*.aar
|
||||
*.ap_
|
||||
*.aab
|
||||
|
||||
# Files for the ART/Dalvik VM
|
||||
*.dex
|
||||
|
||||
# Java class files
|
||||
*.class
|
||||
|
||||
# Generated files
|
||||
bin/
|
||||
gen/
|
||||
out/
|
||||
# Uncomment the following line in case you need and you don't have the release build type files in your app
|
||||
# release/
|
||||
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Proguard folder generated by Eclipse
|
||||
proguard/
|
||||
|
||||
# Log Files
|
||||
*.log
|
||||
|
||||
# Android Studio Navigation editor temp files
|
||||
.navigation/
|
||||
|
||||
# Android Studio captures folder
|
||||
captures/
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/workspace.xml
|
||||
.idea/tasks.xml
|
||||
.idea/gradle.xml
|
||||
.idea/assetWizardSettings.xml
|
||||
.idea/dictionaries
|
||||
.idea/libraries
|
||||
# Android Studio 3 in .gitignore file.
|
||||
.idea/caches
|
||||
.idea/modules.xml
|
||||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
|
||||
.idea/navEditor.xml
|
||||
|
||||
# Keystore files
|
||||
# Uncomment the following lines if you do not want to check your keystore files in.
|
||||
#*.jks
|
||||
#*.keystore
|
||||
|
||||
# External native build folder generated in Android Studio 2.2 and later
|
||||
.externalNativeBuild
|
||||
.cxx/
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
# google-services.json
|
||||
|
||||
# Freeline
|
||||
freeline.py
|
||||
freeline/
|
||||
freeline_project_description.json
|
||||
|
||||
# fastlane
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
fastlane/readme.md
|
||||
|
||||
# Version control
|
||||
vcs.xml
|
||||
|
||||
# lint
|
||||
lint/intermediates/
|
||||
lint/generated/
|
||||
lint/outputs/
|
||||
lint/tmp/
|
||||
# lint/reports/
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
|
||||
# Cordova plugins for Capacitor
|
||||
capacitor-cordova-android-plugins
|
||||
|
||||
# Copied web assets
|
||||
app/src/main/assets/public
|
||||
|
||||
# Generated Config files
|
||||
app/src/main/assets/capacitor.config.json
|
||||
app/src/main/assets/capacitor.plugins.json
|
||||
app/src/main/res/xml/config.xml
|
||||
2
android/app/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/build/*
|
||||
!/build/.npmkeep
|
||||
54
android/app/build.gradle
Normal file
@ -0,0 +1,54 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
namespace = "com.nomadhub.app"
|
||||
compileSdk = rootProject.ext.compileSdkVersion
|
||||
defaultConfig {
|
||||
applicationId "com.nomadhub.app"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
aaptOptions {
|
||||
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
|
||||
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
|
||||
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
flatDir{
|
||||
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
|
||||
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
|
||||
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
|
||||
implementation project(':capacitor-android')
|
||||
testImplementation "junit:junit:$junitVersion"
|
||||
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
|
||||
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
|
||||
implementation project(':capacitor-cordova-android-plugins')
|
||||
}
|
||||
|
||||
apply from: 'capacitor.build.gradle'
|
||||
|
||||
try {
|
||||
def servicesJSON = file('google-services.json')
|
||||
if (servicesJSON.text) {
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
}
|
||||
} catch(Exception e) {
|
||||
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
|
||||
}
|
||||
19
android/app/capacitor.build.gradle
Normal file
@ -0,0 +1,19 @@
|
||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||
|
||||
android {
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_21
|
||||
targetCompatibility JavaVersion.VERSION_21
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
implementation project(':capacitor-preferences')
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (hasProperty('postBuildExtras')) {
|
||||
postBuildExtras()
|
||||
}
|
||||
21
android/app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,26 @@
|
||||
package com.getcapacitor.myapp;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
import androidx.test.platform.app.InstrumentationRegistry;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
|
||||
@Test
|
||||
public void useAppContext() throws Exception {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
|
||||
|
||||
assertEquals("com.getcapacitor.app", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
43
android/app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:hardwareAccelerated="true"
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation|density"
|
||||
android:name=".MainActivity"
|
||||
android:label="@string/title_activity_main"
|
||||
android:theme="@style/AppTheme.NoActionBarLaunch"
|
||||
android:launchMode="singleTask"
|
||||
android:hardwareAccelerated="true"
|
||||
android:exported="true">
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<provider
|
||||
android:name="androidx.core.content.FileProvider"
|
||||
android:authorities="${applicationId}.fileprovider"
|
||||
android:exported="false"
|
||||
android:grantUriPermissions="true">
|
||||
<meta-data
|
||||
android:name="android.support.FILE_PROVIDER_PATHS"
|
||||
android:resource="@xml/file_paths"></meta-data>
|
||||
</provider>
|
||||
</application>
|
||||
|
||||
<!-- Permissions -->
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
||||
@ -0,0 +1,5 @@
|
||||
package com.nomadhub.app;
|
||||
|
||||
import com.getcapacitor.BridgeActivity;
|
||||
|
||||
public class MainActivity extends BridgeActivity {}
|
||||
BIN
android/app/src/main/res/drawable-land-hdpi/splash.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
android/app/src/main/res/drawable-land-mdpi/splash.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
android/app/src/main/res/drawable-land-xhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 9.0 KiB |
BIN
android/app/src/main/res/drawable-land-xxhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
android/app/src/main/res/drawable-land-xxxhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
android/app/src/main/res/drawable-port-hdpi/splash.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
android/app/src/main/res/drawable-port-mdpi/splash.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
android/app/src/main/res/drawable-port-xhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
android/app/src/main/res/drawable-port-xxhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
android/app/src/main/res/drawable-port-xxxhdpi/splash.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0" />
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1" />
|
||||
</vector>
|
||||
170
android/app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillColor="#26A69A"
|
||||
android:pathData="M0,0h108v108h-108z" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF"
|
||||
android:strokeWidth="0.8" />
|
||||
</vector>
|
||||
BIN
android/app/src/main/res/drawable/splash.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
12
android/app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<WebView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
BIN
android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 15 KiB |
BIN
android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#FFFFFF</color>
|
||||
</resources>
|
||||
7
android/app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<string name="app_name">NomadHub</string>
|
||||
<string name="title_activity_main">NomadHub</string>
|
||||
<string name="package_name">com.nomadhub.app</string>
|
||||
<string name="custom_url_scheme">com.nomadhub.app</string>
|
||||
</resources>
|
||||
22
android/app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
<item name="android:background">@null</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="AppTheme.NoActionBarLaunch" parent="Theme.SplashScreen">
|
||||
<item name="android:background">@drawable/splash</item>
|
||||
</style>
|
||||
</resources>
|
||||
5
android/app/src/main/res/xml/file_paths.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<external-path name="my_images" path="." />
|
||||
<cache-path name="my_cache_images" path="." />
|
||||
</paths>
|
||||
@ -0,0 +1,18 @@
|
||||
package com.getcapacitor.myapp;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
|
||||
@Test
|
||||
public void addition_isCorrect() throws Exception {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||
29
android/build.gradle
Normal file
@ -0,0 +1,29 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.13.0'
|
||||
classpath 'com.google.gms:google-services:4.4.4'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "variables.gradle"
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
6
android/capacitor.settings.gradle
Normal file
@ -0,0 +1,6 @@
|
||||
// DO NOT EDIT THIS FILE! IT IS GENERATED EACH TIME "capacitor update" IS RUN
|
||||
include ':capacitor-android'
|
||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
||||
|
||||
include ':capacitor-preferences'
|
||||
project(':capacitor-preferences').projectDir = new File('../node_modules/@capacitor/preferences/android')
|
||||
22
android/gradle.properties
Normal file
@ -0,0 +1,22 @@
|
||||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
|
||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
||||
# Android operating system, and which are packaged with your app's APK
|
||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
||||
android.useAndroidX=true
|
||||
BIN
android/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
7
android/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=120000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
251
android/gradlew
vendored
Normal file
@ -0,0 +1,251 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
94
android/gradlew.bat
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
5
android/settings.gradle
Normal file
@ -0,0 +1,5 @@
|
||||
include ':app'
|
||||
include ':capacitor-cordova-android-plugins'
|
||||
project(':capacitor-cordova-android-plugins').projectDir = new File('./capacitor-cordova-android-plugins/')
|
||||
|
||||
apply from: 'capacitor.settings.gradle'
|
||||
16
android/variables.gradle
Normal file
@ -0,0 +1,16 @@
|
||||
ext {
|
||||
minSdkVersion = 24
|
||||
compileSdkVersion = 36
|
||||
targetSdkVersion = 36
|
||||
androidxActivityVersion = '1.11.0'
|
||||
androidxAppCompatVersion = '1.7.1'
|
||||
androidxCoordinatorLayoutVersion = '1.3.0'
|
||||
androidxCoreVersion = '1.17.0'
|
||||
androidxFragmentVersion = '1.8.9'
|
||||
coreSplashScreenVersion = '1.2.0'
|
||||
androidxWebkitVersion = '1.14.0'
|
||||
junitVersion = '4.13.2'
|
||||
androidxJunitVersion = '1.3.0'
|
||||
androidxEspressoCoreVersion = '3.7.0'
|
||||
cordovaAndroidVersion = '14.0.1'
|
||||
}
|
||||
11
capacitor.config.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"appId": "com.nomadhub.app",
|
||||
"appName": "NomadHub",
|
||||
"webDir": "dist",
|
||||
"server": {
|
||||
"androidScheme": "https"
|
||||
},
|
||||
"android": {
|
||||
"allowMixedContent": true
|
||||
}
|
||||
}
|
||||
19
index.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
|
||||
<meta name="theme-color" content="#0a0e17" />
|
||||
<meta name="mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Noto+Sans+SC:wght@400;500;600;700&display=swap" rel="stylesheet" />
|
||||
<title>NomadHub · 数字游民人际操作系统</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
3129
package-lock.json
generated
Normal file
37
package.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "nomadhub",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc -b && vite build",
|
||||
"lint": "oxlint",
|
||||
"preview": "vite preview",
|
||||
"cap:sync": "npm run build && npx cap sync android",
|
||||
"apk": "npm run cap:sync && cd android && gradlew.bat assembleDebug"
|
||||
},
|
||||
"dependencies": {
|
||||
"@capacitor/android": "^8.5.2",
|
||||
"@capacitor/cli": "^8.5.2",
|
||||
"@capacitor/core": "^8.5.2",
|
||||
"@capacitor/preferences": "^8.0.1",
|
||||
"@react-three/drei": "^10.7.9",
|
||||
"@react-three/fiber": "^9.8.1",
|
||||
"framer-motion": "^14.0.0",
|
||||
"lucide-react": "^1.52.0",
|
||||
"react": "^19.2.8",
|
||||
"react-dom": "^19.2.8",
|
||||
"three": "^0.186.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.13.3",
|
||||
"@types/react": "^19.2.18",
|
||||
"@types/react-dom": "^19.2.7",
|
||||
"@types/three": "^0.186.0",
|
||||
"@vitejs/plugin-react": "^6.1.1",
|
||||
"oxlint": "^1.81.0",
|
||||
"typescript": "~6.0.2",
|
||||
"vite": "^8.3.0"
|
||||
}
|
||||
}
|
||||
8
public/favicon.svg
Normal file
@ -0,0 +1,8 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" fill="none">
|
||||
<circle cx="32" cy="32" r="30" fill="#0a0e17"/>
|
||||
<circle cx="32" cy="32" r="22" stroke="#4ECDC4" stroke-width="2.5" fill="none"/>
|
||||
<circle cx="32" cy="32" r="14" stroke="#FF6B6B" stroke-width="1.5" fill="none" opacity="0.7"/>
|
||||
<circle cx="44" cy="20" r="4" fill="#FFE66D"/>
|
||||
<circle cx="22" cy="40" r="3" fill="#4ECDC4"/>
|
||||
<circle cx="38" cy="42" r="2.5" fill="#FF6B6B"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 459 B |
24
public/icons.svg
Normal file
@ -0,0 +1,24 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<symbol id="bluesky-icon" viewBox="0 0 16 17">
|
||||
<g clip-path="url(#bluesky-clip)"><path fill="#08060d" d="M7.75 7.735c-.693-1.348-2.58-3.86-4.334-5.097-1.68-1.187-2.32-.981-2.74-.79C.188 2.065.1 2.812.1 3.251s.241 3.602.398 4.13c.52 1.744 2.367 2.333 4.07 2.145-2.495.37-4.71 1.278-1.805 4.512 3.196 3.309 4.38-.71 4.987-2.746.608 2.036 1.307 5.91 4.93 2.746 2.72-2.746.747-4.143-1.747-4.512 1.702.189 3.55-.4 4.07-2.145.156-.528.397-3.691.397-4.13s-.088-1.186-.575-1.406c-.42-.19-1.06-.395-2.741.79-1.755 1.24-3.64 3.752-4.334 5.099"/></g>
|
||||
<defs><clipPath id="bluesky-clip"><path fill="#fff" d="M.1.85h15.3v15.3H.1z"/></clipPath></defs>
|
||||
</symbol>
|
||||
<symbol id="discord-icon" viewBox="0 0 20 19">
|
||||
<path fill="#08060d" d="M16.224 3.768a14.5 14.5 0 0 0-3.67-1.153c-.158.286-.343.67-.47.976a13.5 13.5 0 0 0-4.067 0c-.128-.306-.317-.69-.476-.976A14.4 14.4 0 0 0 3.868 3.77C1.546 7.28.916 10.703 1.231 14.077a14.7 14.7 0 0 0 4.5 2.306q.545-.748.965-1.587a9.5 9.5 0 0 1-1.518-.74q.191-.14.372-.293c2.927 1.369 6.107 1.369 8.999 0q.183.152.372.294-.723.437-1.52.74.418.838.963 1.588a14.6 14.6 0 0 0 4.504-2.308c.37-3.911-.63-7.302-2.644-10.309m-9.13 8.234c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.894 0 1.614.82 1.599 1.82.001 1-.705 1.82-1.6 1.82m5.91 0c-.878 0-1.599-.82-1.599-1.82 0-.998.705-1.82 1.6-1.82.893 0 1.614.82 1.599 1.82 0 1-.706 1.82-1.6 1.82"/>
|
||||
</symbol>
|
||||
<symbol id="documentation-icon" viewBox="0 0 21 20">
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="m15.5 13.333 1.533 1.322c.645.555.967.833.967 1.178s-.322.623-.967 1.179L15.5 18.333m-3.333-5-1.534 1.322c-.644.555-.966.833-.966 1.178s.322.623.966 1.179l1.534 1.321"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M17.167 10.836v-4.32c0-1.41 0-2.117-.224-2.68-.359-.906-1.118-1.621-2.08-1.96-.599-.21-1.349-.21-2.848-.21-2.623 0-3.935 0-4.983.369-1.684.591-3.013 1.842-3.641 3.428C3 6.449 3 7.684 3 10.154v2.122c0 2.558 0 3.838.706 4.726q.306.383.713.671c.76.536 1.79.64 3.581.66"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M3 10a2.78 2.78 0 0 1 2.778-2.778c.555 0 1.209.097 1.748-.047.48-.129.854-.503.982-.982.145-.54.048-1.194.048-1.749a2.78 2.78 0 0 1 2.777-2.777"/>
|
||||
</symbol>
|
||||
<symbol id="github-icon" viewBox="0 0 19 19">
|
||||
<path fill="#08060d" fill-rule="evenodd" d="M9.356 1.85C5.05 1.85 1.57 5.356 1.57 9.694a7.84 7.84 0 0 0 5.324 7.44c.387.079.528-.168.528-.376 0-.182-.013-.805-.013-1.454-2.165.467-2.616-.935-2.616-.935-.349-.91-.864-1.143-.864-1.143-.71-.48.051-.48.051-.48.787.051 1.2.805 1.2.805.695 1.194 1.817.857 2.268.649.064-.507.27-.857.49-1.052-1.728-.182-3.545-.857-3.545-3.87 0-.857.31-1.558.8-2.104-.078-.195-.349-1 .077-2.078 0 0 .657-.208 2.14.805a7.5 7.5 0 0 1 1.946-.26c.657 0 1.328.092 1.946.26 1.483-1.013 2.14-.805 2.14-.805.426 1.078.155 1.883.078 2.078.502.546.799 1.247.799 2.104 0 3.013-1.818 3.675-3.558 3.87.284.247.528.714.528 1.454 0 1.052-.012 1.896-.012 2.156 0 .208.142.455.528.377a7.84 7.84 0 0 0 5.324-7.441c.013-4.338-3.48-7.844-7.773-7.844" clip-rule="evenodd"/>
|
||||
</symbol>
|
||||
<symbol id="social-icon" viewBox="0 0 20 20">
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M12.5 6.667a4.167 4.167 0 1 0-8.334 0 4.167 4.167 0 0 0 8.334 0"/>
|
||||
<path fill="none" stroke="#aa3bff" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.35" d="M2.5 16.667a5.833 5.833 0 0 1 8.75-5.053m3.837.474.513 1.035c.07.144.257.282.414.309l.93.155c.596.1.736.536.307.965l-.723.73a.64.64 0 0 0-.152.531l.207.903c.164.715-.213.991-.84.618l-.872-.52a.63.63 0 0 0-.577 0l-.872.52c-.624.373-1.003.094-.84-.618l.207-.903a.64.64 0 0 0-.152-.532l-.723-.729c-.426-.43-.289-.864.306-.964l.93-.156a.64.64 0 0 0 .412-.31l.513-1.034c.28-.562.735-.562 1.012 0"/>
|
||||
</symbol>
|
||||
<symbol id="x-icon" viewBox="0 0 19 19">
|
||||
<path fill="#08060d" fill-rule="evenodd" d="M1.893 1.98c.052.072 1.245 1.769 2.653 3.77l2.892 4.114c.183.261.333.48.333.486s-.068.089-.152.183l-.522.593-.765.867-3.597 4.087c-.375.426-.734.834-.798.905a1 1 0 0 0-.118.148c0 .01.236.017.664.017h.663l.729-.83c.4-.457.796-.906.879-.999a692 692 0 0 0 1.794-2.038c.034-.037.301-.34.594-.675l.551-.624.345-.392a7 7 0 0 1 .34-.374c.006 0 .93 1.306 2.052 2.903l2.084 2.965.045.063h2.275c1.87 0 2.273-.003 2.266-.021-.008-.02-1.098-1.572-3.894-5.547-2.013-2.862-2.28-3.246-2.273-3.266.008-.019.282-.332 2.085-2.38l2-2.274 1.567-1.782c.022-.028-.016-.03-.65-.03h-.674l-.3.342a871 871 0 0 1-1.782 2.025c-.067.075-.405.458-.75.852a100 100 0 0 1-.803.91c-.148.172-.299.344-.99 1.127-.304.343-.32.358-.345.327-.015-.019-.904-1.282-1.976-2.808L6.365 1.85H1.8zm1.782.91 8.078 11.294c.772 1.08 1.413 1.973 1.425 1.984.016.017.241.02 1.05.017l1.03-.004-2.694-3.766L7.796 5.75 5.722 2.852l-1.039-.004-1.039-.004z" clip-rule="evenodd"/>
|
||||
</symbol>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
45
src/App.tsx
Normal file
@ -0,0 +1,45 @@
|
||||
import { useState } from 'react'
|
||||
import { AuroraBg } from './components/Layout/AuroraBg'
|
||||
import { BottomNav, type TabId } from './components/Layout/BottomNav'
|
||||
import { ProfileCard } from './components/ProfileCard/ProfileCard'
|
||||
import { DisguisePage } from './pages/DisguisePage'
|
||||
import { MapPage } from './pages/MapPage'
|
||||
import { PeoplePage } from './pages/PeoplePage'
|
||||
import { RosterPage } from './pages/RosterPage'
|
||||
import { SettingsPage } from './pages/SettingsPage'
|
||||
import { useContacts } from './store/useContacts'
|
||||
|
||||
export default function App() {
|
||||
const [tab, setTab] = useState<TabId>('map')
|
||||
const api = useContacts()
|
||||
|
||||
if (api.settings.disguiseEnabled && !api.settings.unlocked) {
|
||||
return <DisguisePage api={api} />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="app-shell">
|
||||
<AuroraBg />
|
||||
<main className="app-main">
|
||||
{tab === 'map' && <MapPage api={api} />}
|
||||
{tab === 'people' && <PeoplePage api={api} />}
|
||||
{tab === 'roster' && <RosterPage api={api} />}
|
||||
{tab === 'settings' && <SettingsPage api={api} />}
|
||||
|
||||
{api.selected && (
|
||||
<ProfileCard
|
||||
contact={api.selected}
|
||||
onClose={() => api.setSelectedId(null)}
|
||||
onStar={() => api.toggleStar(api.selected!.id)}
|
||||
onBlacklist={() => api.blacklist(api.selected!.id)}
|
||||
onStageChange={(stage) => api.setStage(api.selected!.id, stage)}
|
||||
onMarkInteraction={() => api.markInteraction(api.selected!.id)}
|
||||
onAddChatLog={(text) => api.addChatLog(api.selected!.id, text)}
|
||||
onUpdateNotes={(notes) => api.updateContact(api.selected!.id, { notes })}
|
||||
/>
|
||||
)}
|
||||
</main>
|
||||
<BottomNav active={tab} onChange={setTab} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
103
src/components/Filters/ContactFilterPanel.css
Normal file
@ -0,0 +1,103 @@
|
||||
.cfp {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.cfp__search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-radius: var(--radius-md);
|
||||
color: var(--text-muted);
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(18px);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.cfp__search input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
outline: none;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.cfp__search input::placeholder {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.cfp__toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
position: relative;
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
.cfp__toggle em {
|
||||
font-style: normal;
|
||||
margin-left: 6px;
|
||||
padding: 1px 7px;
|
||||
border-radius: 999px;
|
||||
background: var(--gradient-main);
|
||||
color: #0a0e17;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.cfp__toggle svg.is-open {
|
||||
transform: rotate(180deg);
|
||||
transition: transform var(--transition);
|
||||
}
|
||||
|
||||
.cfp__reset {
|
||||
position: absolute;
|
||||
right: 36px;
|
||||
color: var(--accent-3);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
|
||||
.cfp__grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
padding: 14px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
.cfp__grid label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.cfp__grid select {
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
border: var(--border-glass);
|
||||
background: rgba(10, 14, 23, 0.6);
|
||||
color: var(--text-primary);
|
||||
font-size: 12px;
|
||||
font-family: inherit;
|
||||
}
|
||||
168
src/components/Filters/ContactFilterPanel.tsx
Normal file
@ -0,0 +1,168 @@
|
||||
import { ChevronDown, RotateCcw, Search } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { SOURCE_LABELS, STAGE_LABELS, STAGE_ORDER } from '../../types/contact'
|
||||
import type { ContactSource } from '../../types/contact'
|
||||
import {
|
||||
countActiveFilters,
|
||||
DEFAULT_FILTERS,
|
||||
type ContactFilters,
|
||||
type PeopleListFilter,
|
||||
} from '../../types/filters'
|
||||
import './ContactFilterPanel.css'
|
||||
|
||||
interface ContactFilterPanelProps {
|
||||
filters: ContactFilters
|
||||
occupations: string[]
|
||||
onChange: (patch: Partial<ContactFilters>) => void
|
||||
onReset: () => void
|
||||
listFilter?: PeopleListFilter
|
||||
onListFilterChange?: (v: PeopleListFilter) => void
|
||||
showListFilter?: boolean
|
||||
}
|
||||
|
||||
export function ContactFilterPanel({
|
||||
filters,
|
||||
occupations,
|
||||
onChange,
|
||||
onReset,
|
||||
listFilter,
|
||||
onListFilterChange,
|
||||
showListFilter,
|
||||
}: ContactFilterPanelProps) {
|
||||
const [expanded, setExpanded] = useState(false)
|
||||
const active = countActiveFilters(filters)
|
||||
|
||||
return (
|
||||
<div className="cfp">
|
||||
<div className="cfp__search glass">
|
||||
<Search size={16} />
|
||||
<input
|
||||
type="search"
|
||||
placeholder="搜索姓名 / 职业 / 城市 / 微信"
|
||||
value={filters.search}
|
||||
onChange={(e) => onChange({ search: e.target.value })}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="filter-bar">
|
||||
{(
|
||||
[
|
||||
['all', '全部'],
|
||||
['business', '业务'],
|
||||
['dating', '约会'],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
className={`filter-chip ${filters.purpose === key ? 'is-active' : ''}`}
|
||||
onClick={() => onChange({ purpose: key })}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{showListFilter && onListFilterChange && (
|
||||
<div className="filter-bar filter-bar--secondary">
|
||||
{(
|
||||
[
|
||||
['all', '全部'],
|
||||
['starred', '★收藏'],
|
||||
['followup', '待跟进'],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
className={`filter-chip filter-chip--ghost ${listFilter === key ? 'is-active' : ''}`}
|
||||
onClick={() => onListFilterChange(key)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<button type="button" className="cfp__toggle glass" onClick={() => setExpanded(!expanded)}>
|
||||
<span>高级筛选 {active > 0 && <em>{active}</em>}</span>
|
||||
<ChevronDown size={16} className={expanded ? 'is-open' : ''} />
|
||||
{active > 0 && (
|
||||
<i
|
||||
className="cfp__reset"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
onReset()
|
||||
}}
|
||||
>
|
||||
<RotateCcw size={14} />
|
||||
</i>
|
||||
)}
|
||||
</button>
|
||||
|
||||
{expanded && (
|
||||
<div className="cfp__grid glass">
|
||||
<label>
|
||||
性别
|
||||
<select value={filters.gender} onChange={(e) => onChange({ gender: e.target.value as ContactFilters['gender'] })}>
|
||||
<option value="all">全部</option>
|
||||
<option value="female">女</option>
|
||||
<option value="male">男</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
年龄
|
||||
<select value={filters.age} onChange={(e) => onChange({ age: e.target.value as ContactFilters['age'] })}>
|
||||
<option value="all">全部</option>
|
||||
<option value="under25"><25</option>
|
||||
<option value="25to30">25-30</option>
|
||||
<option value="over30">>30</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
感情
|
||||
<select value={filters.status} onChange={(e) => onChange({ status: e.target.value as ContactFilters['status'] })}>
|
||||
<option value="all">全部</option>
|
||||
<option value="single">单身</option>
|
||||
<option value="married">已婚</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
来源
|
||||
<select value={filters.source} onChange={(e) => onChange({ source: e.target.value as ContactSource | 'all' })}>
|
||||
<option value="all">全部</option>
|
||||
{(Object.keys(SOURCE_LABELS) as ContactSource[]).map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{SOURCE_LABELS[k]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
进度
|
||||
<select value={filters.stage} onChange={(e) => onChange({ stage: e.target.value as ContactFilters['stage'] })}>
|
||||
<option value="all">全部</option>
|
||||
{STAGE_ORDER.map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{STAGE_LABELS[k]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
职业
|
||||
<select value={filters.occupation} onChange={(e) => onChange({ occupation: e.target.value })}>
|
||||
{occupations.map((o) => (
|
||||
<option key={o} value={o}>
|
||||
{o === 'all' ? '全部' : o}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export { DEFAULT_FILTERS }
|
||||
208
src/components/Globe/Globe2D.css
Normal file
@ -0,0 +1,208 @@
|
||||
/* nomadro hub-globe 1:1 风格 */
|
||||
.globe2d {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
touch-action: none;
|
||||
cursor: grab;
|
||||
user-select: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.globe2d:active {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
.globe2d__float-wrap {
|
||||
animation: hub-globe-float 6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.globe2d__container {
|
||||
position: relative;
|
||||
width: min(88vw, 400px);
|
||||
aspect-ratio: 1;
|
||||
transform-origin: center center;
|
||||
transition: transform 0.08s ease-out;
|
||||
}
|
||||
|
||||
@keyframes hub-globe-float {
|
||||
0%,
|
||||
100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translateY(-12px);
|
||||
}
|
||||
}
|
||||
|
||||
.hub-globe-svg,
|
||||
.globe2d__overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.globe2d__overlay {
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.hub-orbit-ring,
|
||||
.hub-orbit-ring-2 {
|
||||
transform-box: fill-box;
|
||||
transform-origin: center;
|
||||
animation: hub-orbit-spin 20s linear infinite;
|
||||
}
|
||||
|
||||
.hub-orbit-ring-2 {
|
||||
animation-direction: reverse;
|
||||
animation-duration: 15s;
|
||||
}
|
||||
|
||||
@keyframes hub-orbit-spin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.hub-continent {
|
||||
animation: hub-continent-pulse 4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes hub-continent-pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 0.7;
|
||||
}
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.hub-pulse-dot {
|
||||
animation: hub-dot-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes hub-dot-pulse {
|
||||
0%,
|
||||
100% {
|
||||
r: 5;
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
r: 8;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.hub-flight-path {
|
||||
animation: hub-dash-move 3s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes hub-dash-move {
|
||||
to {
|
||||
stroke-dashoffset: -20;
|
||||
}
|
||||
}
|
||||
|
||||
/* 浮动城市标签 — 与 nomadro hub-float-card 一致 */
|
||||
.globe2d__labels {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.hub-float-card {
|
||||
position: absolute;
|
||||
transform: translate(-50%, -50%);
|
||||
z-index: 2;
|
||||
padding: 10px 14px;
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
backdrop-filter: blur(20px);
|
||||
box-shadow: var(--shadow-card);
|
||||
animation: hub-card-float 4s ease-in-out infinite;
|
||||
white-space: nowrap;
|
||||
pointer-events: auto;
|
||||
cursor: pointer;
|
||||
touch-action: manipulation;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.hub-float-card em {
|
||||
font-style: normal;
|
||||
min-width: 16px;
|
||||
height: 16px;
|
||||
padding: 0 4px;
|
||||
border-radius: 999px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 9px;
|
||||
font-weight: 700;
|
||||
color: #0a0e17;
|
||||
background: var(--gradient-main);
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
@keyframes hub-card-float {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate(-50%, -50%) translateY(0);
|
||||
}
|
||||
50% {
|
||||
transform: translate(-50%, -50%) translateY(-8px);
|
||||
}
|
||||
}
|
||||
|
||||
.globe2d__zoom {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
bottom: 18%;
|
||||
z-index: 30;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.globe2d__zoom-btn {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1;
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.globe2d__zoom-btn:active {
|
||||
transform: scale(0.94);
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
}
|
||||
|
||||
.globe2d__zoom-val {
|
||||
font-family: var(--font-display);
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: var(--accent-3);
|
||||
min-width: 36px;
|
||||
text-align: center;
|
||||
}
|
||||
393
src/components/Globe/Globe2D.tsx
Normal file
@ -0,0 +1,393 @@
|
||||
import {
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
type PointerEvent as ReactPointerEvent,
|
||||
type WheelEvent as ReactWheelEvent,
|
||||
} from 'react'
|
||||
import type { Contact } from '../../types/contact'
|
||||
import { clusterByCity, clusterByCountry } from '../../data/mockContacts'
|
||||
import './Globe2D.css'
|
||||
|
||||
interface MarkerItem {
|
||||
id: string
|
||||
label: string
|
||||
emoji: string
|
||||
count: number
|
||||
lat: number
|
||||
lng: number
|
||||
onClick: () => void
|
||||
}
|
||||
|
||||
interface Globe2DProps {
|
||||
contacts: Contact[]
|
||||
focusCountry: string | null
|
||||
focusCity: string | null
|
||||
onSelectCountry: (country: string) => void
|
||||
onSelectCity: (city: string) => void
|
||||
onSelectContact: (id: string) => void
|
||||
}
|
||||
|
||||
const CX = 200
|
||||
const CY = 200
|
||||
const R = 120
|
||||
|
||||
const DOT_COLORS = ['#FF6B6B', '#FFE66D', '#4ECDC4', '#A78BFA', '#FB923C']
|
||||
|
||||
const CITY_EMOJI: Record<string, string> = {
|
||||
清迈: '🏔️',
|
||||
巴厘岛: '🏝️',
|
||||
里斯本: '☕',
|
||||
东京: '🗼',
|
||||
曼谷: '🌴',
|
||||
上海: '🌃',
|
||||
深圳: '🏙️',
|
||||
新加坡: '🦁',
|
||||
迪拜: '🕌',
|
||||
柏林: '🍺',
|
||||
伦敦: '☕',
|
||||
纽约: '🗽',
|
||||
洛杉矶: '🌅',
|
||||
墨西哥城: '🌮',
|
||||
布宜诺斯艾利斯: '💃',
|
||||
}
|
||||
|
||||
function emojiFor(label: string, i: number) {
|
||||
if (CITY_EMOJI[label]) return CITY_EMOJI[label]
|
||||
return ['🏝️', '☕', '🏔️', '🌴', '🗼'][i % 5]
|
||||
}
|
||||
|
||||
function project(lat: number, lng: number, rotY: number, radius: number) {
|
||||
const latRad = (lat * Math.PI) / 180
|
||||
const lngRad = ((lng + rotY) * Math.PI) / 180
|
||||
const x = Math.cos(latRad) * Math.sin(lngRad)
|
||||
const y = Math.sin(latRad)
|
||||
const z = Math.cos(latRad) * Math.cos(lngRad)
|
||||
return {
|
||||
x: x * radius,
|
||||
y: -y * radius,
|
||||
z,
|
||||
visible: z > -0.12,
|
||||
opacity: 0.45 + Math.max(0, z) * 0.55,
|
||||
}
|
||||
}
|
||||
|
||||
const ZOOM_MIN = 0.75
|
||||
const ZOOM_MAX = 2.2
|
||||
|
||||
function clampZoom(v: number) {
|
||||
return Math.min(ZOOM_MAX, Math.max(ZOOM_MIN, v))
|
||||
}
|
||||
|
||||
/** nomadro hub-globe SVG — 线框 + 半透明大陆 + 轨道环 */
|
||||
function HubGlobeBase({ rotY }: { rotY: number }) {
|
||||
return (
|
||||
<svg className="globe2d__svg hub-globe-svg" viewBox="0 0 400 400" aria-hidden>
|
||||
<defs>
|
||||
<radialGradient id="hubGlobeGlow" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0%" stopColor="#4ECDC4" stopOpacity="0.3" />
|
||||
<stop offset="100%" stopColor="#4ECDC4" stopOpacity="0" />
|
||||
</radialGradient>
|
||||
<linearGradient id="hubOrbitGrad" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stopColor="#FF6B6B" />
|
||||
<stop offset="100%" stopColor="#4ECDC4" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
|
||||
<circle cx={CX} cy={CY} r="160" fill="url(#hubGlobeGlow)" />
|
||||
<circle cx={CX} cy={CY} r="120" fill="none" stroke="rgba(78,205,196,0.2)" strokeWidth="1" />
|
||||
<circle cx={CX} cy={CY} r="90" fill="none" stroke="rgba(78,205,196,0.15)" strokeWidth="1" />
|
||||
|
||||
<ellipse
|
||||
className="hub-orbit-ring"
|
||||
cx={CX}
|
||||
cy={CY}
|
||||
rx="120"
|
||||
ry="40"
|
||||
fill="none"
|
||||
stroke="rgba(78,205,196,0.3)"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
<ellipse
|
||||
className="hub-orbit-ring hub-orbit-ring-2"
|
||||
cx={CX}
|
||||
cy={CY}
|
||||
rx="40"
|
||||
ry="120"
|
||||
fill="none"
|
||||
stroke="rgba(255,107,107,0.3)"
|
||||
strokeWidth="1.5"
|
||||
/>
|
||||
|
||||
<g className="globe2d__rotating" style={{ transformOrigin: `${CX}px ${CY}px`, transform: `rotate(${rotY * 0.35}deg)` }}>
|
||||
<path
|
||||
className="hub-continent"
|
||||
d="M160 140 Q180 130 200 135 Q220 128 240 140 Q250 155 245 170 Q235 185 220 190 Q200 195 185 188 Q165 180 160 165 Z"
|
||||
fill="rgba(78,205,196,0.4)"
|
||||
/>
|
||||
<path
|
||||
className="hub-continent"
|
||||
d="M130 210 Q145 200 160 215 Q155 235 140 240 Q125 235 130 210 Z"
|
||||
fill="rgba(78,205,196,0.3)"
|
||||
/>
|
||||
<path
|
||||
className="hub-continent"
|
||||
d="M250 200 Q270 195 280 210 Q275 230 260 235 Q245 228 250 200 Z"
|
||||
fill="rgba(78,205,196,0.35)"
|
||||
/>
|
||||
</g>
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
export function Globe2D({
|
||||
contacts,
|
||||
focusCountry,
|
||||
focusCity,
|
||||
onSelectCountry,
|
||||
onSelectCity,
|
||||
onSelectContact,
|
||||
}: Globe2DProps) {
|
||||
const [rotY, setRotY] = useState(0)
|
||||
const [zoom, setZoom] = useState(1)
|
||||
const zoomRef = useRef(1)
|
||||
const pointers = useRef<Map<number, { x: number; y: number }>>(new Map())
|
||||
const pinch = useRef<{ dist: number; zoom: number } | null>(null)
|
||||
|
||||
const drag = useRef({ active: false, x: 0, y: 0, rot: 0 })
|
||||
const tap = useRef<{ id: string | null; x: number; y: number }>({ id: null, x: 0, y: 0 })
|
||||
|
||||
const applyZoom = (next: number) => {
|
||||
const z = clampZoom(next)
|
||||
zoomRef.current = z
|
||||
setZoom(z)
|
||||
}
|
||||
|
||||
const markers: MarkerItem[] = useMemo(() => {
|
||||
if (focusCity) {
|
||||
return contacts
|
||||
.filter((c) => c.location.city === focusCity)
|
||||
.map((c, i) => ({
|
||||
id: c.id,
|
||||
label: c.name,
|
||||
emoji: emojiFor(c.location.city, i),
|
||||
count: 1,
|
||||
lat: c.location.lat,
|
||||
lng: c.location.lng,
|
||||
onClick: () => onSelectContact(c.id),
|
||||
}))
|
||||
}
|
||||
if (focusCountry) {
|
||||
return clusterByCity(contacts.filter((c) => c.location.country === focusCountry)).map(
|
||||
(city, i) => ({
|
||||
id: city.city,
|
||||
label: city.city,
|
||||
emoji: emojiFor(city.city, i),
|
||||
count: city.contacts.length,
|
||||
lat: city.lat,
|
||||
lng: city.lng,
|
||||
onClick: () => onSelectCity(city.city),
|
||||
}),
|
||||
)
|
||||
}
|
||||
return clusterByCountry(contacts).map((country, i) => ({
|
||||
id: country.country,
|
||||
label: country.country,
|
||||
emoji: emojiFor(country.country, i),
|
||||
count: country.contacts.length,
|
||||
lat: country.lat,
|
||||
lng: country.lng,
|
||||
onClick: () => onSelectCountry(country.country),
|
||||
}))
|
||||
}, [contacts, focusCountry, focusCity, onSelectCountry, onSelectCity, onSelectContact])
|
||||
|
||||
const projected = useMemo(
|
||||
() =>
|
||||
markers
|
||||
.map((m, i) => {
|
||||
const p = project(m.lat, m.lng, rotY, R)
|
||||
return { ...m, ...p, color: DOT_COLORS[i % DOT_COLORS.length] }
|
||||
})
|
||||
.filter((m) => m.visible),
|
||||
[markers, rotY],
|
||||
)
|
||||
|
||||
const flightPaths = useMemo(() => {
|
||||
const pts = projected.slice(0, 4)
|
||||
const paths: string[] = []
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
const a = pts[i]
|
||||
const b = pts[i + 1]
|
||||
const mx = (CX + a.x + CX + b.x) / 2
|
||||
const my = (CY + a.y + CY + b.y) / 2 - 30
|
||||
paths.push(`M ${CX + a.x} ${CY + a.y} Q ${mx} ${my} ${CX + b.x} ${CY + b.y}`)
|
||||
}
|
||||
return paths
|
||||
}, [projected])
|
||||
|
||||
const pointerDistance = () => {
|
||||
const pts = [...pointers.current.values()]
|
||||
if (pts.length < 2) return 0
|
||||
return Math.hypot(pts[0].x - pts[1].x, pts[0].y - pts[1].y)
|
||||
}
|
||||
|
||||
const onPointerDown = (e: ReactPointerEvent) => {
|
||||
pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY })
|
||||
if (pointers.current.size >= 2) {
|
||||
drag.current.active = false
|
||||
pinch.current = { dist: pointerDistance(), zoom: zoomRef.current }
|
||||
return
|
||||
}
|
||||
drag.current = { active: true, x: e.clientX, y: e.clientY, rot: rotY }
|
||||
;(e.currentTarget as HTMLElement).setPointerCapture(e.pointerId)
|
||||
}
|
||||
|
||||
const onPointerMove = (e: ReactPointerEvent) => {
|
||||
if (pointers.current.has(e.pointerId)) {
|
||||
pointers.current.set(e.pointerId, { x: e.clientX, y: e.clientY })
|
||||
}
|
||||
if (pointers.current.size >= 2 && pinch.current) {
|
||||
const dist = pointerDistance()
|
||||
if (pinch.current.dist > 0) applyZoom(pinch.current.zoom * (dist / pinch.current.dist))
|
||||
return
|
||||
}
|
||||
if (!drag.current.active) return
|
||||
setRotY(drag.current.rot + (e.clientX - drag.current.x) * 0.5)
|
||||
}
|
||||
|
||||
const onPointerUp = (e: ReactPointerEvent) => {
|
||||
pointers.current.delete(e.pointerId)
|
||||
if (pointers.current.size < 2) pinch.current = null
|
||||
if (pointers.current.size === 0) drag.current.active = false
|
||||
try {
|
||||
;(e.currentTarget as HTMLElement).releasePointerCapture(e.pointerId)
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
}
|
||||
|
||||
const onWheel = (e: ReactWheelEvent) => {
|
||||
e.preventDefault()
|
||||
applyZoom(zoomRef.current * (e.deltaY > 0 ? 0.92 : 1.08))
|
||||
}
|
||||
|
||||
const onMarkerTap = (e: ReactPointerEvent, marker: MarkerItem) => {
|
||||
e.stopPropagation()
|
||||
const dx = Math.abs(e.clientX - tap.current.x)
|
||||
const dy = Math.abs(e.clientY - tap.current.y)
|
||||
if (tap.current.id === marker.id && dx < 12 && dy < 12) marker.onClick()
|
||||
tap.current = { id: null, x: 0, y: 0 }
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="globe2d"
|
||||
onPointerDown={onPointerDown}
|
||||
onPointerMove={onPointerMove}
|
||||
onPointerUp={onPointerUp}
|
||||
onPointerCancel={onPointerUp}
|
||||
onWheel={onWheel}
|
||||
>
|
||||
<div className="globe2d__float-wrap">
|
||||
<div className="globe2d__container" style={{ transform: `scale(${zoom})` }}>
|
||||
<HubGlobeBase rotY={rotY} />
|
||||
|
||||
<svg className="globe2d__overlay" viewBox="0 0 400 400" aria-hidden>
|
||||
<defs>
|
||||
<linearGradient id="hubOrbitGradOverlay" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stopColor="#FF6B6B" />
|
||||
<stop offset="100%" stopColor="#4ECDC4" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
{flightPaths.map((d, i) => (
|
||||
<path
|
||||
key={i}
|
||||
className="hub-flight-path"
|
||||
d={d}
|
||||
fill="none"
|
||||
stroke="url(#hubOrbitGradOverlay)"
|
||||
strokeWidth="2"
|
||||
strokeDasharray="6 4"
|
||||
/>
|
||||
))}
|
||||
{projected.map((m, i) => (
|
||||
<circle
|
||||
key={m.id}
|
||||
className="hub-pulse-dot"
|
||||
cx={CX + m.x}
|
||||
cy={CY + m.y}
|
||||
r="5"
|
||||
fill={m.color}
|
||||
opacity={m.opacity}
|
||||
style={{ animationDelay: `${i * 0.35}s` }}
|
||||
/>
|
||||
))}
|
||||
</svg>
|
||||
|
||||
<div className="globe2d__labels">
|
||||
{projected.map((m, i) => {
|
||||
const lx = 50 + (m.x / 400) * 100
|
||||
const ly = 50 + (m.y / 400) * 100
|
||||
const offsetX = m.x >= 0 ? 8 : -8
|
||||
const offsetY = m.y >= 0 ? -28 : 28
|
||||
return (
|
||||
<button
|
||||
key={m.id}
|
||||
type="button"
|
||||
className="hub-float-card"
|
||||
style={{
|
||||
left: `calc(${lx}% + ${offsetX}px)`,
|
||||
top: `calc(${ly}% + ${offsetY}px)`,
|
||||
opacity: m.opacity,
|
||||
animationDelay: `${-i * 1.2}s`,
|
||||
zIndex: 10 + i,
|
||||
}}
|
||||
onPointerDown={(e) => {
|
||||
e.stopPropagation()
|
||||
tap.current = { id: m.id, x: e.clientX, y: e.clientY }
|
||||
}}
|
||||
onPointerUp={(e) => onMarkerTap(e, m)}
|
||||
onClick={(e) => {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}}
|
||||
>
|
||||
{m.emoji} {m.label}
|
||||
{m.count > 1 && <em>{m.count}</em>}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="globe2d__zoom">
|
||||
<button
|
||||
type="button"
|
||||
className="globe2d__zoom-btn"
|
||||
aria-label="放大"
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
applyZoom(zoomRef.current * 1.15)
|
||||
}}
|
||||
>
|
||||
+
|
||||
</button>
|
||||
<span className="globe2d__zoom-val">{Math.round(zoom * 100)}%</span>
|
||||
<button
|
||||
type="button"
|
||||
className="globe2d__zoom-btn"
|
||||
aria-label="缩小"
|
||||
onPointerDown={(e) => e.stopPropagation()}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
applyZoom(zoomRef.current / 1.15)
|
||||
}}
|
||||
>
|
||||
−
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
54
src/components/Layout/AuroraBg.css
Normal file
@ -0,0 +1,54 @@
|
||||
.aurora-bg {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
z-index: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.aurora-bg__shape {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
filter: blur(90px);
|
||||
opacity: 0.45;
|
||||
animation: auroraFloat 8s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.aurora-bg__shape--1 {
|
||||
width: min(70vw, 380px);
|
||||
height: min(70vw, 380px);
|
||||
background: var(--accent-1);
|
||||
top: -12%;
|
||||
left: -18%;
|
||||
}
|
||||
|
||||
.aurora-bg__shape--2 {
|
||||
width: min(60vw, 320px);
|
||||
height: min(60vw, 320px);
|
||||
background: var(--accent-3);
|
||||
top: 35%;
|
||||
right: -22%;
|
||||
animation-delay: -3s;
|
||||
}
|
||||
|
||||
.aurora-bg__shape--3 {
|
||||
width: min(50vw, 260px);
|
||||
height: min(50vw, 260px);
|
||||
background: var(--accent-2);
|
||||
bottom: 8%;
|
||||
left: 20%;
|
||||
animation-delay: -5s;
|
||||
}
|
||||
|
||||
@keyframes auroraFloat {
|
||||
0%,
|
||||
100% {
|
||||
transform: translate(0, 0) scale(1);
|
||||
}
|
||||
33% {
|
||||
transform: translate(18px, -18px) scale(1.05);
|
||||
}
|
||||
66% {
|
||||
transform: translate(-12px, 12px) scale(0.96);
|
||||
}
|
||||
}
|
||||
12
src/components/Layout/AuroraBg.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import './AuroraBg.css'
|
||||
|
||||
/** nomadro H5 hub-hero-bg-shapes 同款 aurora 光斑 */
|
||||
export function AuroraBg() {
|
||||
return (
|
||||
<div className="aurora-bg" aria-hidden>
|
||||
<span className="aurora-bg__shape aurora-bg__shape--1" />
|
||||
<span className="aurora-bg__shape aurora-bg__shape--2" />
|
||||
<span className="aurora-bg__shape aurora-bg__shape--3" />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
53
src/components/Layout/BottomNav.css
Normal file
@ -0,0 +1,53 @@
|
||||
/* nomadro hub bottom tab bar */
|
||||
.bottom-nav {
|
||||
position: relative;
|
||||
z-index: 50;
|
||||
height: calc(var(--nav-h) + var(--safe-bottom));
|
||||
padding: 6px 12px calc(6px + var(--safe-bottom));
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 4px;
|
||||
background: rgba(10, 14, 23, 0.88);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border-top: var(--border-glass);
|
||||
}
|
||||
|
||||
.bottom-nav__item {
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
color: var(--text-muted);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
font-family: var(--font-display);
|
||||
border-radius: 14px;
|
||||
padding: 6px 4px;
|
||||
transition: color var(--transition), background var(--transition);
|
||||
}
|
||||
|
||||
.bottom-nav__item.is-active {
|
||||
color: var(--text-primary);
|
||||
background: rgba(78, 205, 196, 0.08);
|
||||
}
|
||||
|
||||
.bottom-nav__item.is-active span {
|
||||
background: var(--gradient-text);
|
||||
background-size: 200% auto;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
}
|
||||
|
||||
.bottom-nav__indicator {
|
||||
position: absolute;
|
||||
bottom: 2px;
|
||||
width: 20px;
|
||||
height: 3px;
|
||||
border-radius: 999px;
|
||||
background: var(--gradient-main);
|
||||
box-shadow: 0 0 12px rgba(78, 205, 196, 0.5);
|
||||
}
|
||||
35
src/components/Layout/BottomNav.tsx
Normal file
@ -0,0 +1,35 @@
|
||||
import { ClipboardList, Globe2, Settings, Users } from 'lucide-react'
|
||||
import './BottomNav.css'
|
||||
|
||||
export type TabId = 'map' | 'people' | 'roster' | 'settings'
|
||||
|
||||
const TABS: { id: TabId; label: string; icon: typeof Globe2 }[] = [
|
||||
{ id: 'map', label: '地球', icon: Globe2 },
|
||||
{ id: 'people', label: '人脉', icon: Users },
|
||||
{ id: 'roster', label: '花名册', icon: ClipboardList },
|
||||
{ id: 'settings', label: '设置', icon: Settings },
|
||||
]
|
||||
|
||||
interface BottomNavProps {
|
||||
active: TabId
|
||||
onChange: (tab: TabId) => void
|
||||
}
|
||||
|
||||
export function BottomNav({ active, onChange }: BottomNavProps) {
|
||||
return (
|
||||
<nav className="bottom-nav">
|
||||
{TABS.map(({ id, label, icon: Icon }) => (
|
||||
<button
|
||||
key={id}
|
||||
type="button"
|
||||
className={`bottom-nav__item ${active === id ? 'is-active' : ''}`}
|
||||
onClick={() => onChange(id)}
|
||||
>
|
||||
<Icon size={20} strokeWidth={active === id ? 2.4 : 1.8} />
|
||||
<span>{label}</span>
|
||||
{active === id && <i className="bottom-nav__indicator" />}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
10
src/components/Layout/NomadLogo.css
Normal file
@ -0,0 +1,10 @@
|
||||
.nomad-logo {
|
||||
flex-shrink: 0;
|
||||
animation: logoSpin 20s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes logoSpin {
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
23
src/components/Layout/NomadLogo.tsx
Normal file
@ -0,0 +1,23 @@
|
||||
import './NomadLogo.css'
|
||||
|
||||
interface NomadLogoProps {
|
||||
size?: number
|
||||
}
|
||||
|
||||
/** nomadro H5 hub-logo 旋转圆环标记 */
|
||||
export function NomadLogo({ size = 34 }: NomadLogoProps) {
|
||||
return (
|
||||
<svg
|
||||
className="nomad-logo"
|
||||
width={size}
|
||||
height={size}
|
||||
viewBox="0 0 64 64"
|
||||
aria-hidden
|
||||
>
|
||||
<circle cx="32" cy="32" r="28" fill="none" stroke="#4ecdc4" strokeWidth="2" opacity="0.85" />
|
||||
<circle cx="32" cy="32" r="18" fill="none" stroke="#ff6b6b" strokeWidth="1.5" opacity="0.65" />
|
||||
<circle cx="44" cy="18" r="4" fill="#ffe66d" />
|
||||
<circle cx="20" cy="42" r="3" fill="#4ecdc4" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
39
src/components/Layout/PageHeader.css
Normal file
@ -0,0 +1,39 @@
|
||||
.page-header {
|
||||
padding: 18px 18px 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.page-header__row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page-header__text h1 {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.65rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.15;
|
||||
}
|
||||
|
||||
.page-header__text p {
|
||||
margin-top: 6px;
|
||||
font-size: 0.88rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.page-header__actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.hub-count {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
color: var(--accent-3);
|
||||
font-weight: 600;
|
||||
font-family: var(--font-display);
|
||||
}
|
||||
26
src/components/Layout/PageHeader.tsx
Normal file
@ -0,0 +1,26 @@
|
||||
import type { ReactNode } from 'react'
|
||||
import './PageHeader.css'
|
||||
|
||||
interface PageHeaderProps {
|
||||
title: string
|
||||
subtitle?: string
|
||||
count?: number
|
||||
actions?: ReactNode
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export function PageHeader({ title, subtitle, count, actions, children }: PageHeaderProps) {
|
||||
return (
|
||||
<header className="page-header">
|
||||
<div className="page-header__row">
|
||||
<div className="page-header__text">
|
||||
<h1 className="gradient-text">{title}</h1>
|
||||
{subtitle && <p>{subtitle}</p>}
|
||||
</div>
|
||||
{actions && <div className="page-header__actions">{actions}</div>}
|
||||
</div>
|
||||
{children}
|
||||
{count !== undefined && <p className="hub-count">{count} 人</p>}
|
||||
</header>
|
||||
)
|
||||
}
|
||||
93
src/components/People/AddContactForm.css
Normal file
@ -0,0 +1,93 @@
|
||||
.add-contact-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 90;
|
||||
background: rgba(10, 14, 23, 0.72);
|
||||
backdrop-filter: blur(10px);
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.add-contact {
|
||||
width: min(100%, 400px);
|
||||
max-height: 85%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: var(--radius-lg);
|
||||
padding: 18px;
|
||||
background: linear-gradient(160deg, rgba(255, 107, 107, 0.08), rgba(78, 205, 196, 0.06)), var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(20px);
|
||||
box-shadow: var(--shadow-card), var(--shadow-glow);
|
||||
}
|
||||
|
||||
.add-contact header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
|
||||
.add-contact header h2 {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.2rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.add-contact header button {
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.add-contact__fields {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.add-contact label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.add-contact input,
|
||||
.add-contact select,
|
||||
.add-contact textarea {
|
||||
padding: 10px 12px;
|
||||
border-radius: 12px;
|
||||
border: var(--border-glass);
|
||||
background: rgba(10, 14, 23, 0.55);
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
.add-contact__row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.add-contact__save {
|
||||
margin-top: 14px;
|
||||
padding: 12px;
|
||||
border-radius: 12px;
|
||||
font-weight: 700;
|
||||
font-family: var(--font-display);
|
||||
color: #0a0e17;
|
||||
background: var(--gradient-main);
|
||||
box-shadow: 0 4px 16px rgba(255, 107, 107, 0.22);
|
||||
}
|
||||
135
src/components/People/AddContactForm.tsx
Normal file
@ -0,0 +1,135 @@
|
||||
import { X } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import type { Contact, ContactPurpose, ContactSource } from '../../types/contact'
|
||||
import { SOURCE_LABELS } from '../../types/contact'
|
||||
import './AddContactForm.css'
|
||||
|
||||
interface AddContactFormProps {
|
||||
onClose: () => void
|
||||
onSave: (contact: Omit<Contact, 'id'>) => void
|
||||
}
|
||||
|
||||
export function AddContactForm({ onClose, onSave }: AddContactFormProps) {
|
||||
const [name, setName] = useState('')
|
||||
const [age, setAge] = useState('26')
|
||||
const [gender, setGender] = useState<'female' | 'male'>('female')
|
||||
const [occupation, setOccupation] = useState('')
|
||||
const [city, setCity] = useState('')
|
||||
const [country, setCountry] = useState('中国')
|
||||
const [purpose, setPurpose] = useState<ContactPurpose>('business')
|
||||
const [source, setSource] = useState<ContactSource>('offline')
|
||||
const [wechat, setWechat] = useState('')
|
||||
const [phone, setPhone] = useState('')
|
||||
const [bio, setBio] = useState('')
|
||||
|
||||
const submit = () => {
|
||||
if (!name.trim() || !occupation.trim() || !city.trim()) return
|
||||
const color = '#4ECDC4'
|
||||
const initial = encodeURIComponent(name.slice(0, 1))
|
||||
const photo = `data:image/svg+xml,${encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><rect width="200" height="200" fill="${color}"/><text x="100" y="115" text-anchor="middle" fill="#fff" font-size="72" font-family="sans-serif">${initial}</text></svg>`,
|
||||
)}`
|
||||
onSave({
|
||||
name: name.trim(),
|
||||
gender,
|
||||
age: Number(age) || 25,
|
||||
occupation: occupation.trim(),
|
||||
relationshipStatus: 'unknown',
|
||||
purpose,
|
||||
photos: [photo],
|
||||
avatarColor: color,
|
||||
bio: bio.trim() || '新添加的人脉',
|
||||
location: { country, countryCode: 'CN', city: city.trim(), lat: 35, lng: 105 },
|
||||
phone: phone.trim() || undefined,
|
||||
wechat: wechat.trim() || undefined,
|
||||
tags: [],
|
||||
source,
|
||||
stage: 'met',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 0,
|
||||
notes: '',
|
||||
chatLog: [],
|
||||
})
|
||||
onClose()
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="add-contact-overlay" onClick={onClose}>
|
||||
<div className="add-contact" onClick={(e) => e.stopPropagation()}>
|
||||
<header>
|
||||
<h2>添加人脉</h2>
|
||||
<button type="button" onClick={onClose}>
|
||||
<X size={18} />
|
||||
</button>
|
||||
</header>
|
||||
<div className="add-contact__fields scroll-y hub-field">
|
||||
<label>
|
||||
姓名 *
|
||||
<input value={name} onChange={(e) => setName(e.target.value)} placeholder="姓名" />
|
||||
</label>
|
||||
<div className="add-contact__row">
|
||||
<label>
|
||||
年龄
|
||||
<input type="number" value={age} onChange={(e) => setAge(e.target.value)} />
|
||||
</label>
|
||||
<label>
|
||||
性别
|
||||
<select value={gender} onChange={(e) => setGender(e.target.value as 'female' | 'male')}>
|
||||
<option value="female">女</option>
|
||||
<option value="male">男</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<label>
|
||||
职业 *
|
||||
<input value={occupation} onChange={(e) => setOccupation(e.target.value)} placeholder="职业" />
|
||||
</label>
|
||||
<div className="add-contact__row">
|
||||
<label>
|
||||
城市 *
|
||||
<input value={city} onChange={(e) => setCity(e.target.value)} placeholder="城市" />
|
||||
</label>
|
||||
<label>
|
||||
国家
|
||||
<input value={country} onChange={(e) => setCountry(e.target.value)} />
|
||||
</label>
|
||||
</div>
|
||||
<label>
|
||||
类型
|
||||
<select value={purpose} onChange={(e) => setPurpose(e.target.value as ContactPurpose)}>
|
||||
<option value="business">业务</option>
|
||||
<option value="dating">约会</option>
|
||||
<option value="both">双栖</option>
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
来源
|
||||
<select value={source} onChange={(e) => setSource(e.target.value as ContactSource)}>
|
||||
{(Object.keys(SOURCE_LABELS) as ContactSource[]).map((k) => (
|
||||
<option key={k} value={k}>
|
||||
{SOURCE_LABELS[k]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
微信
|
||||
<input value={wechat} onChange={(e) => setWechat(e.target.value)} />
|
||||
</label>
|
||||
<label>
|
||||
电话
|
||||
<input value={phone} onChange={(e) => setPhone(e.target.value)} />
|
||||
</label>
|
||||
<label>
|
||||
简介
|
||||
<textarea value={bio} onChange={(e) => setBio(e.target.value)} rows={3} />
|
||||
</label>
|
||||
</div>
|
||||
<button type="button" className="add-contact__save" onClick={submit}>
|
||||
保存
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
162
src/components/People/SwipeDeck.css
Normal file
@ -0,0 +1,162 @@
|
||||
.swipe-deck {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 8px 16px 16px;
|
||||
}
|
||||
|
||||
.swipe-deck__stack {
|
||||
position: relative;
|
||||
width: min(100%, 340px);
|
||||
height: min(52vh, 420px);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.swipe-card {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
border-radius: var(--radius-lg);
|
||||
overflow: hidden;
|
||||
background: linear-gradient(160deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.06)), var(--bg-card);
|
||||
border: 1px solid rgba(255, 107, 107, 0.18);
|
||||
box-shadow: var(--shadow-card), var(--shadow-glow);
|
||||
touch-action: none;
|
||||
cursor: grab;
|
||||
backdrop-filter: blur(18px);
|
||||
}
|
||||
|
||||
.swipe-card--back {
|
||||
transform: scale(0.94) translateY(12px);
|
||||
opacity: 0.55;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.swipe-card--back img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.swipe-card__photo {
|
||||
width: 100%;
|
||||
height: 72%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.swipe-card__like,
|
||||
.swipe-card__nope {
|
||||
position: absolute;
|
||||
top: 24px;
|
||||
z-index: 3;
|
||||
padding: 6px 12px;
|
||||
border: 3px solid;
|
||||
border-radius: 8px;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 800;
|
||||
font-size: 22px;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.swipe-card__like {
|
||||
left: 16px;
|
||||
color: var(--accent-3);
|
||||
border-color: var(--accent-3);
|
||||
transform: rotate(-12deg);
|
||||
}
|
||||
|
||||
.swipe-card__nope {
|
||||
right: 16px;
|
||||
color: var(--accent-1);
|
||||
border-color: var(--accent-1);
|
||||
transform: rotate(12deg);
|
||||
}
|
||||
|
||||
.swipe-card__info {
|
||||
padding: 14px 16px;
|
||||
}
|
||||
|
||||
.swipe-card__info h3 {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.35rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
.swipe-card__info h3 span {
|
||||
font-size: 1rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.swipe-card__info > p {
|
||||
margin-top: 4px;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.swipe-card__tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.swipe-card__tags span {
|
||||
font-size: 10px;
|
||||
padding: 3px 8px;
|
||||
border-radius: 999px;
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
color: var(--accent-3);
|
||||
border: 1px solid rgba(78, 205, 196, 0.2);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.swipe-deck__actions {
|
||||
display: flex;
|
||||
gap: 28px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.swipe-act {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: var(--border-glass);
|
||||
background: var(--bg-glass);
|
||||
backdrop-filter: blur(12px);
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
|
||||
.swipe-act:active {
|
||||
transform: scale(0.92);
|
||||
}
|
||||
|
||||
.swipe-act--ban {
|
||||
color: var(--accent-1);
|
||||
box-shadow: 0 0 20px rgba(255, 107, 107, 0.15);
|
||||
}
|
||||
|
||||
.swipe-act--star {
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
color: var(--accent-2);
|
||||
background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(78, 205, 196, 0.2));
|
||||
box-shadow: 0 0 28px rgba(78, 205, 196, 0.2);
|
||||
}
|
||||
|
||||
.swipe-deck__hint {
|
||||
margin-top: 10px;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
font-family: var(--font-display);
|
||||
}
|
||||
|
||||
.swipe-empty {
|
||||
flex: 1;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
}
|
||||
130
src/components/People/SwipeDeck.tsx
Normal file
@ -0,0 +1,130 @@
|
||||
import { AnimatePresence, motion, useMotionValue, useTransform } from 'framer-motion'
|
||||
import { Ban, Star } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import type { Contact } from '../../types/contact'
|
||||
import { GENDER_LABELS, SOURCE_LABELS, STAGE_LABELS, STATUS_LABELS } from '../../types/contact'
|
||||
import './SwipeDeck.css'
|
||||
|
||||
interface SwipeDeckProps {
|
||||
contacts: Contact[]
|
||||
onOpen: (id: string) => void
|
||||
onStar: (id: string) => void
|
||||
onBlacklist: (id: string) => void
|
||||
}
|
||||
|
||||
function SwipeCard({
|
||||
contact,
|
||||
onOpen,
|
||||
onStar,
|
||||
onBlacklist,
|
||||
isTop,
|
||||
}: {
|
||||
contact: Contact
|
||||
onOpen: () => void
|
||||
onStar: () => void
|
||||
onBlacklist: () => void
|
||||
isTop: boolean
|
||||
}) {
|
||||
const x = useMotionValue(0)
|
||||
const rotate = useTransform(x, [-200, 200], [-14, 14])
|
||||
const likeOpacity = useTransform(x, [40, 120], [0, 1])
|
||||
const nopeOpacity = useTransform(x, [-120, -40], [1, 0])
|
||||
|
||||
if (!isTop) {
|
||||
return (
|
||||
<div className="swipe-card swipe-card--back">
|
||||
<img src={contact.photos[0]} alt={contact.name} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
className="swipe-card"
|
||||
style={{ x, rotate }}
|
||||
drag="x"
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
dragElastic={0.85}
|
||||
onDragEnd={(_, info) => {
|
||||
if (info.offset.x > 100) onStar()
|
||||
else if (info.offset.x < -100) onBlacklist()
|
||||
}}
|
||||
onClick={onOpen}
|
||||
>
|
||||
<motion.span className="swipe-card__like" style={{ opacity: likeOpacity }}>
|
||||
LIKE
|
||||
</motion.span>
|
||||
<motion.span className="swipe-card__nope" style={{ opacity: nopeOpacity }}>
|
||||
NOPE
|
||||
</motion.span>
|
||||
<img src={contact.photos[0]} alt={contact.name} className="swipe-card__photo" />
|
||||
<div className="swipe-card__info">
|
||||
<h3>
|
||||
{contact.name} <span>{contact.age}</span>
|
||||
</h3>
|
||||
<p>
|
||||
{contact.occupation} · {contact.location.city}
|
||||
</p>
|
||||
<div className="swipe-card__tags">
|
||||
<span>{GENDER_LABELS[contact.gender]}</span>
|
||||
<span>{STATUS_LABELS[contact.relationshipStatus]}</span>
|
||||
<span>{SOURCE_LABELS[contact.source]}</span>
|
||||
<span>{STAGE_LABELS[contact.stage]}</span>
|
||||
</div>
|
||||
</div>
|
||||
</motion.div>
|
||||
)
|
||||
}
|
||||
|
||||
export function SwipeDeck({ contacts, onOpen, onStar, onBlacklist }: SwipeDeckProps) {
|
||||
const [index, setIndex] = useState(0)
|
||||
const current = contacts[index]
|
||||
const next = contacts[index + 1]
|
||||
|
||||
if (!current) {
|
||||
return <p className="swipe-empty hub-empty">没有更多卡片了,调整筛选试试</p>
|
||||
}
|
||||
|
||||
const advance = (action: () => void) => {
|
||||
action()
|
||||
setIndex((i) => Math.min(i + 1, contacts.length))
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="swipe-deck">
|
||||
<div className="swipe-deck__stack">
|
||||
{next && (
|
||||
<SwipeCard
|
||||
key={next.id + '-back'}
|
||||
contact={next}
|
||||
isTop={false}
|
||||
onOpen={() => {}}
|
||||
onStar={() => {}}
|
||||
onBlacklist={() => {}}
|
||||
/>
|
||||
)}
|
||||
<AnimatePresence mode="popLayout">
|
||||
<SwipeCard
|
||||
key={current.id}
|
||||
contact={current}
|
||||
isTop
|
||||
onOpen={() => onOpen(current.id)}
|
||||
onStar={() => advance(() => onStar(current.id))}
|
||||
onBlacklist={() => advance(() => onBlacklist(current.id))}
|
||||
/>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
<div className="swipe-deck__actions">
|
||||
<button type="button" className="swipe-act swipe-act--ban" onClick={() => advance(() => onBlacklist(current.id))}>
|
||||
<Ban size={22} />
|
||||
</button>
|
||||
<button type="button" className="swipe-act swipe-act--star" onClick={() => advance(() => onStar(current.id))}>
|
||||
<Star size={24} />
|
||||
</button>
|
||||
</div>
|
||||
<p className="swipe-deck__hint">
|
||||
{index + 1} / {contacts.length} · 左右滑或点击查看详情
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
413
src/components/ProfileCard/ProfileCard.css
Normal file
@ -0,0 +1,413 @@
|
||||
.profile-overlay {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 80;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 16px 16px calc(var(--nav-h) + 12px);
|
||||
background: rgba(10, 14, 23, 0.65);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.profile-card {
|
||||
position: relative;
|
||||
width: min(100%, 380px);
|
||||
max-height: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-radius: var(--radius-lg);
|
||||
background: linear-gradient(160deg, rgba(255, 107, 107, 0.1), rgba(78, 205, 196, 0.08)), rgba(17, 24, 39, 0.96);
|
||||
border: 1px solid rgba(255, 107, 107, 0.18);
|
||||
box-shadow: var(--shadow-card), var(--shadow-glow);
|
||||
touch-action: none;
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.profile-card__close {
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
z-index: 5;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: rgba(10, 14, 23, 0.55);
|
||||
border: var(--border-glass);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.profile-card__stamp {
|
||||
position: absolute;
|
||||
top: 28px;
|
||||
z-index: 4;
|
||||
padding: 6px 12px;
|
||||
border: 3px solid;
|
||||
border-radius: 8px;
|
||||
font-family: var(--font-display);
|
||||
font-weight: 800;
|
||||
font-size: 22px;
|
||||
letter-spacing: 0.08em;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.profile-card__stamp--like {
|
||||
left: 18px;
|
||||
color: var(--accent-3);
|
||||
border-color: var(--accent-3);
|
||||
transform: rotate(-14deg);
|
||||
}
|
||||
|
||||
.profile-card__stamp--nope {
|
||||
right: 18px;
|
||||
color: var(--accent-1);
|
||||
border-color: var(--accent-1);
|
||||
transform: rotate(14deg);
|
||||
}
|
||||
|
||||
.profile-card__photo-wrap {
|
||||
position: relative;
|
||||
height: 280px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.profile-card__photo {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.profile-card__photo-fade {
|
||||
position: absolute;
|
||||
inset: auto 0 0;
|
||||
height: 100px;
|
||||
background: linear-gradient(transparent, rgba(10, 14, 23, 0.98));
|
||||
}
|
||||
|
||||
.profile-card__badges {
|
||||
position: absolute;
|
||||
left: 14px;
|
||||
bottom: 18px;
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.purpose-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
background: rgba(10, 14, 23, 0.7);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.purpose-chip--business {
|
||||
color: var(--accent-3);
|
||||
}
|
||||
.purpose-chip--dating {
|
||||
color: var(--accent-1);
|
||||
}
|
||||
.purpose-chip--both {
|
||||
color: var(--accent-2);
|
||||
}
|
||||
|
||||
.star-chip {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--accent-2);
|
||||
background: rgba(10, 14, 23, 0.7);
|
||||
border: 1px solid rgba(255, 230, 109, 0.35);
|
||||
}
|
||||
|
||||
.profile-card__body {
|
||||
padding: 4px 18px 18px;
|
||||
overflow-y: auto;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.profile-card__header h2 {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.55rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.profile-card__header h2 span {
|
||||
font-size: 1.15rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.profile-card__header p {
|
||||
margin-top: 4px;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
|
||||
.profile-card__bio {
|
||||
margin-top: 12px;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.65;
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.profile-card__tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 12px;
|
||||
}
|
||||
|
||||
.profile-card__tags span {
|
||||
padding: 4px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 11px;
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
color: var(--accent-3);
|
||||
border: 1px solid rgba(78, 205, 196, 0.2);
|
||||
}
|
||||
|
||||
.profile-card__tags .tag-muted {
|
||||
background: var(--bg-glass);
|
||||
color: var(--text-muted);
|
||||
border-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.profile-card__contacts {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.contact-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 7px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 12px;
|
||||
text-decoration: none;
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.stage-funnel {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.stage-funnel__title,
|
||||
.chat-preview__title {
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.stage-funnel__track {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.stage-dot {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.stage-dot i {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
border-radius: 999px;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.stage-dot.is-active i {
|
||||
background: var(--gradient-main);
|
||||
}
|
||||
|
||||
.stage-dot span {
|
||||
font-size: 8px;
|
||||
color: var(--text-muted);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.stage-dot.is-active span {
|
||||
color: var(--accent-3);
|
||||
}
|
||||
|
||||
.chat-preview {
|
||||
margin-top: 14px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 14px;
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.chat-preview p {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.5;
|
||||
padding: 3px 0;
|
||||
}
|
||||
|
||||
.chat-preview__empty {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.profile-card__demographics {
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.profile-card__warn {
|
||||
margin-left: 8px;
|
||||
font-style: normal;
|
||||
color: var(--accent-1);
|
||||
}
|
||||
|
||||
.profile-notes {
|
||||
margin-top: 14px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 14px;
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.profile-notes__head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.profile-notes__head button {
|
||||
font-size: 11px;
|
||||
color: var(--accent-3);
|
||||
text-transform: none;
|
||||
letter-spacing: 0;
|
||||
}
|
||||
|
||||
.profile-notes p {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.profile-notes textarea {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border-radius: 8px;
|
||||
border: var(--border-glass);
|
||||
background: rgba(10, 14, 23, 0.5);
|
||||
color: var(--text-primary);
|
||||
font-size: 12px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.chat-input {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.chat-input input {
|
||||
flex: 1;
|
||||
padding: 8px 10px;
|
||||
border-radius: 10px;
|
||||
border: var(--border-glass);
|
||||
background: rgba(10, 14, 23, 0.5);
|
||||
color: var(--text-primary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.chat-input button {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--accent-3);
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
border: 1px solid rgba(78, 205, 196, 0.25);
|
||||
}
|
||||
|
||||
.profile-mark-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
width: 100%;
|
||||
margin-top: 12px;
|
||||
padding: 10px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
color: var(--accent-3);
|
||||
background: rgba(78, 205, 196, 0.1);
|
||||
border: 1px solid rgba(78, 205, 196, 0.25);
|
||||
}
|
||||
|
||||
.profile-card__actions {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 28px;
|
||||
margin-top: 16px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
border: var(--border-glass);
|
||||
background: var(--bg-glass);
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn:active {
|
||||
transform: scale(0.92);
|
||||
}
|
||||
|
||||
.action-btn--ban {
|
||||
color: var(--accent-1);
|
||||
box-shadow: 0 0 20px rgba(255, 107, 107, 0.15);
|
||||
}
|
||||
|
||||
.action-btn--star {
|
||||
color: var(--accent-2);
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(78, 205, 196, 0.2));
|
||||
box-shadow: 0 0 28px rgba(78, 205, 196, 0.2);
|
||||
}
|
||||
243
src/components/ProfileCard/ProfileCard.tsx
Normal file
@ -0,0 +1,243 @@
|
||||
import { AnimatePresence, motion, useMotionValue, useTransform } from 'framer-motion'
|
||||
import {
|
||||
Ban,
|
||||
Briefcase,
|
||||
Check,
|
||||
Heart,
|
||||
MessageCircle,
|
||||
Phone,
|
||||
Send,
|
||||
Star,
|
||||
X,
|
||||
} from 'lucide-react'
|
||||
import { useEffect, useState } from 'react'
|
||||
import type { Contact } from '../../types/contact'
|
||||
import { GENDER_LABELS, SOURCE_LABELS, STAGE_LABELS, STAGE_ORDER, STATUS_LABELS } from '../../types/contact'
|
||||
import './ProfileCard.css'
|
||||
|
||||
interface ProfileCardProps {
|
||||
contact: Contact
|
||||
onClose: () => void
|
||||
onStar: () => void
|
||||
onBlacklist: () => void
|
||||
onStageChange: (stage: Contact['stage']) => void
|
||||
onMarkInteraction: () => void
|
||||
onAddChatLog: (text: string) => void
|
||||
onUpdateNotes: (notes: string) => void
|
||||
}
|
||||
|
||||
export function ProfileCard({
|
||||
contact,
|
||||
onClose,
|
||||
onStar,
|
||||
onBlacklist,
|
||||
onStageChange,
|
||||
onMarkInteraction,
|
||||
onAddChatLog,
|
||||
onUpdateNotes,
|
||||
}: ProfileCardProps) {
|
||||
const x = useMotionValue(0)
|
||||
const rotate = useTransform(x, [-200, 200], [-12, 12])
|
||||
const likeOpacity = useTransform(x, [40, 120], [0, 1])
|
||||
const nopeOpacity = useTransform(x, [-120, -40], [1, 0])
|
||||
|
||||
const [chatDraft, setChatDraft] = useState('')
|
||||
const [notesDraft, setNotesDraft] = useState(contact.notes)
|
||||
const [editingNotes, setEditingNotes] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
setNotesDraft(contact.notes)
|
||||
setEditingNotes(false)
|
||||
setChatDraft('')
|
||||
}, [contact.id, contact.notes])
|
||||
|
||||
const purposeLabel =
|
||||
contact.purpose === 'business' ? '业务人脉' : contact.purpose === 'dating' ? '约会' : '业务 · 约会'
|
||||
|
||||
const submitChat = () => {
|
||||
if (!chatDraft.trim()) return
|
||||
onAddChatLog(chatDraft)
|
||||
setChatDraft('')
|
||||
}
|
||||
|
||||
const saveNotes = () => {
|
||||
onUpdateNotes(notesDraft)
|
||||
setEditingNotes(false)
|
||||
}
|
||||
|
||||
return (
|
||||
<AnimatePresence>
|
||||
<motion.div
|
||||
className="profile-overlay"
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
onClick={onClose}
|
||||
>
|
||||
<motion.article
|
||||
className="profile-card"
|
||||
style={{ x, rotate }}
|
||||
drag="x"
|
||||
dragConstraints={{ left: 0, right: 0 }}
|
||||
dragElastic={0.85}
|
||||
onDragEnd={(_, info) => {
|
||||
if (info.offset.x > 120) onStar()
|
||||
else if (info.offset.x < -120) onBlacklist()
|
||||
}}
|
||||
initial={{ y: 60, opacity: 0, scale: 0.94 }}
|
||||
animate={{ y: 0, opacity: 1, scale: 1 }}
|
||||
exit={{ y: 40, opacity: 0, scale: 0.95 }}
|
||||
transition={{ type: 'spring', stiffness: 320, damping: 28 }}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<motion.div className="profile-card__stamp profile-card__stamp--like" style={{ opacity: likeOpacity }}>
|
||||
LIKE
|
||||
</motion.div>
|
||||
<motion.div className="profile-card__stamp profile-card__stamp--nope" style={{ opacity: nopeOpacity }}>
|
||||
NOPE
|
||||
</motion.div>
|
||||
|
||||
<button type="button" className="profile-card__close" onClick={onClose} aria-label="关闭">
|
||||
<X size={18} />
|
||||
</button>
|
||||
|
||||
<div className="profile-card__photo-wrap">
|
||||
<img src={contact.photos[0]} alt={contact.name} className="profile-card__photo" />
|
||||
<div className="profile-card__photo-fade" />
|
||||
<div className="profile-card__badges">
|
||||
<span className={`purpose-chip purpose-chip--${contact.purpose}`}>
|
||||
{contact.purpose === 'business' ? <Briefcase size={12} /> : <Heart size={12} />}
|
||||
{purposeLabel}
|
||||
</span>
|
||||
{contact.starred && (
|
||||
<span className="star-chip">
|
||||
<Star size={12} fill="currentColor" />
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="profile-card__body">
|
||||
<header className="profile-card__header">
|
||||
<h2>
|
||||
{contact.name}
|
||||
<span>{contact.age}</span>
|
||||
</h2>
|
||||
<p>
|
||||
{contact.occupation} · {contact.location.city}, {contact.location.country}
|
||||
</p>
|
||||
<p className="profile-card__demographics">
|
||||
{GENDER_LABELS[contact.gender]} · {STATUS_LABELS[contact.relationshipStatus]}
|
||||
{contact.lastInteractionDays >= 5 && (
|
||||
<em className="profile-card__warn">{contact.lastInteractionDays} 天未互动</em>
|
||||
)}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<p className="profile-card__bio">{contact.bio}</p>
|
||||
|
||||
<div className="profile-card__tags">
|
||||
{contact.tags.map((t) => (
|
||||
<span key={t}>{t}</span>
|
||||
))}
|
||||
<span className="tag-muted">{SOURCE_LABELS[contact.source]}</span>
|
||||
</div>
|
||||
|
||||
<div className="profile-card__contacts">
|
||||
{contact.phone && (
|
||||
<a href={`tel:${contact.phone}`} className="contact-pill">
|
||||
<Phone size={14} /> {contact.phone}
|
||||
</a>
|
||||
)}
|
||||
{contact.wechat && (
|
||||
<span className="contact-pill">
|
||||
<MessageCircle size={14} /> {contact.wechat}
|
||||
</span>
|
||||
)}
|
||||
{contact.telegram && (
|
||||
<a href={`https://t.me/${contact.telegram}`} target="_blank" rel="noreferrer" className="contact-pill">
|
||||
TG · @{contact.telegram}
|
||||
</a>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="stage-funnel">
|
||||
<div className="stage-funnel__title">关系进度 · 认识 → 稳定关系</div>
|
||||
<div className="stage-funnel__track">
|
||||
{STAGE_ORDER.map((stage) => {
|
||||
const activeIndex = STAGE_ORDER.indexOf(contact.stage)
|
||||
const idx = STAGE_ORDER.indexOf(stage)
|
||||
const active = idx <= activeIndex
|
||||
return (
|
||||
<button
|
||||
key={stage}
|
||||
type="button"
|
||||
className={`stage-dot ${active ? 'is-active' : ''}`}
|
||||
onClick={() => onStageChange(stage)}
|
||||
>
|
||||
<i />
|
||||
<span>{STAGE_LABELS[stage]}</span>
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="profile-notes">
|
||||
<div className="profile-notes__head">
|
||||
<span>备注</span>
|
||||
{!editingNotes ? (
|
||||
<button type="button" onClick={() => setEditingNotes(true)}>
|
||||
编辑
|
||||
</button>
|
||||
) : (
|
||||
<button type="button" onClick={saveNotes}>
|
||||
保存
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{editingNotes ? (
|
||||
<textarea value={notesDraft} onChange={(e) => setNotesDraft(e.target.value)} rows={2} />
|
||||
) : (
|
||||
<p>{contact.notes || '暂无备注'}</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="chat-preview">
|
||||
<div className="chat-preview__title">互动记录 / 聊天日志</div>
|
||||
{contact.chatLog.length === 0 && <p className="chat-preview__empty">暂无记录</p>}
|
||||
{contact.chatLog.map((line, i) => (
|
||||
<p key={i}>{line}</p>
|
||||
))}
|
||||
<div className="chat-input">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="添加互动记录..."
|
||||
value={chatDraft}
|
||||
onChange={(e) => setChatDraft(e.target.value)}
|
||||
onKeyDown={(e) => e.key === 'Enter' && submitChat()}
|
||||
/>
|
||||
<button type="button" onClick={submitChat}>
|
||||
<Send size={16} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" className="profile-mark-btn" onClick={onMarkInteraction}>
|
||||
<Check size={16} /> 标记今日已互动
|
||||
</button>
|
||||
|
||||
<div className="profile-card__actions">
|
||||
<button type="button" className="action-btn action-btn--ban" onClick={onBlacklist}>
|
||||
<Ban size={20} />
|
||||
</button>
|
||||
<button type="button" className="action-btn action-btn--star" onClick={onStar}>
|
||||
<Star size={22} fill={contact.starred ? 'currentColor' : 'none'} />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</motion.article>
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
)
|
||||
}
|
||||
328
src/data/mockContacts.ts
Normal file
@ -0,0 +1,328 @@
|
||||
import type { Contact } from '../types/contact'
|
||||
|
||||
const palette = ['#FF6B6B', '#4ECDC4', '#FFE66D', '#A78BFA', '#60A5FA', '#F472B6', '#34D399', '#FB923C']
|
||||
|
||||
function avatar(seed: string, color: string) {
|
||||
const initial = encodeURIComponent(seed.slice(0, 1))
|
||||
return `data:image/svg+xml,${encodeURIComponent(
|
||||
`<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" stop-color="${color}"/>
|
||||
<stop offset="100%" stop-color="#0a0e17"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="200" height="200" fill="url(#g)"/>
|
||||
<circle cx="100" cy="78" r="36" fill="rgba(255,255,255,0.25)"/>
|
||||
<ellipse cx="100" cy="160" rx="58" ry="40" fill="rgba(255,255,255,0.2)"/>
|
||||
<text x="100" y="92" text-anchor="middle" fill="#fff" font-size="42" font-family="Outfit,sans-serif" font-weight="700">${initial}</text>
|
||||
</svg>`,
|
||||
)}`
|
||||
}
|
||||
|
||||
export const MOCK_CONTACTS: Contact[] = [
|
||||
{
|
||||
id: '1',
|
||||
name: '林诗雨',
|
||||
nameEn: 'Shiyu Lin',
|
||||
gender: 'female',
|
||||
age: 24,
|
||||
occupation: '独立设计师',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('林', palette[0])],
|
||||
avatarColor: palette[0],
|
||||
bio: '常驻清迈,喜欢咖啡与胶片摄影。正在筹备个人展览,期待遇见同频的旅居伙伴。',
|
||||
location: { country: '泰国', countryCode: 'TH', city: '清迈', lat: 18.7883, lng: 98.9853 },
|
||||
phone: '66812345678',
|
||||
wechat: 'shiyu_design',
|
||||
telegram: 'shiyulin',
|
||||
tags: ['设计', '摄影', '咖啡'],
|
||||
source: 'xiaohongshu',
|
||||
stage: 'chatting',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 2,
|
||||
notes: '聊过品牌视觉合作可能',
|
||||
chatLog: ['你好,看到你在清迈', '周末可以一起探店吗'],
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
name: 'Alex Chen',
|
||||
gender: 'male',
|
||||
age: 29,
|
||||
occupation: '跨境电商',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'business',
|
||||
photos: [avatar('A', palette[1])],
|
||||
avatarColor: palette[1],
|
||||
bio: '从深圳搬到巴厘岛,做东南亚独立站。有供应链资源,找内容合作与本地运营。',
|
||||
location: { country: '印尼', countryCode: 'ID', city: '巴厘岛', lat: -8.4095, lng: 115.1889 },
|
||||
wechat: 'alexchen_bali',
|
||||
telegram: 'alexchen',
|
||||
tags: ['电商', '供应链', '内容'],
|
||||
source: 'referral',
|
||||
stage: 'interacting',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 1,
|
||||
notes: '下周 coffeechat',
|
||||
chatLog: ['供应链报价已发', 'Bali coworking 见'],
|
||||
},
|
||||
{
|
||||
id: '3',
|
||||
name: '苏晚晴',
|
||||
gender: 'female',
|
||||
age: 23,
|
||||
occupation: '内容创作者',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('苏', palette[5])],
|
||||
avatarColor: palette[5],
|
||||
bio: '小红书旅居博主,正在里斯本写一本关于自由职业的书。喜欢日落和爵士乐。',
|
||||
location: { country: '葡萄牙', countryCode: 'PT', city: '里斯本', lat: 38.7223, lng: -9.1393 },
|
||||
wechat: 'wanqing_lisbon',
|
||||
tags: ['写作', '旅居', '爵士'],
|
||||
source: 'xiaohongshu',
|
||||
stage: 'met',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 6,
|
||||
notes: '六天未互动,需跟进',
|
||||
chatLog: ['关注了你的账号', '里斯本有推荐的 coworking 吗'],
|
||||
},
|
||||
{
|
||||
id: '4',
|
||||
name: 'Maya Patel',
|
||||
gender: 'female',
|
||||
age: 27,
|
||||
occupation: '产品经理',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'both',
|
||||
photos: [avatar('M', palette[2])],
|
||||
avatarColor: palette[2],
|
||||
bio: '印度裔 PM,远程服务欧美客户。喜欢冲浪和创业交流,下周去曼谷。',
|
||||
location: { country: '泰国', countryCode: 'TH', city: '曼谷', lat: 13.7563, lng: 100.5018 },
|
||||
telegram: 'mayapm',
|
||||
tags: ['产品', '冲浪', '创业'],
|
||||
source: 'offline',
|
||||
stage: 'meeting',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 0,
|
||||
notes: '今晚见面',
|
||||
chatLog: ['曼谷见!', '推荐了 Thonglor 的咖啡馆'],
|
||||
},
|
||||
{
|
||||
id: '5',
|
||||
name: '周启航',
|
||||
gender: 'male',
|
||||
age: 31,
|
||||
occupation: 'AI 工程师',
|
||||
relationshipStatus: 'unknown',
|
||||
purpose: 'business',
|
||||
photos: [avatar('周', palette[6])],
|
||||
avatarColor: palette[6],
|
||||
bio: '前大厂算法,现做 AI SaaS。在上海找兼职助理与出海渠道伙伴。',
|
||||
location: { country: '中国', countryCode: 'CN', city: '上海', lat: 31.2304, lng: 121.4737 },
|
||||
phone: '13800138000',
|
||||
wechat: 'qi hang_ai',
|
||||
tags: ['AI', '招聘', 'SaaS'],
|
||||
source: 'wechat',
|
||||
stage: 'interacting',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 3,
|
||||
notes: '简历库对接',
|
||||
chatLog: ['助理 JD 发你了', '希望英语好'],
|
||||
},
|
||||
{
|
||||
id: '6',
|
||||
name: 'Elena Rossi',
|
||||
gender: 'female',
|
||||
age: 26,
|
||||
occupation: '独立摄影师',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('E', palette[0])],
|
||||
avatarColor: palette[0],
|
||||
bio: '米兰出身,现居巴塞罗那。拍人文纪实,周末常去海边。',
|
||||
location: { country: '西班牙', countryCode: 'ES', city: '巴塞罗那', lat: 41.3874, lng: 2.1686 },
|
||||
telegram: 'elenarossi',
|
||||
tags: ['摄影', '人文', '海边'],
|
||||
source: 'travel',
|
||||
stage: 'chatting',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 4,
|
||||
notes: '',
|
||||
chatLog: ['你的作品集很棒', '下次一起拍哥特区'],
|
||||
},
|
||||
{
|
||||
id: '7',
|
||||
name: '陈可欣',
|
||||
gender: 'female',
|
||||
age: 22,
|
||||
occupation: '留学生 / 模特',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('陈', palette[5])],
|
||||
avatarColor: palette[5],
|
||||
bio: '在墨尔本读书,偶尔接商业拍摄。喜欢露营和深夜食堂。',
|
||||
location: { country: '澳大利亚', countryCode: 'AU', city: '墨尔本', lat: -37.8136, lng: 144.9631 },
|
||||
wechat: 'kexin_mel',
|
||||
tags: ['模特', '露营', '美食'],
|
||||
source: 'douyin',
|
||||
stage: 'met',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 8,
|
||||
notes: '久未联系',
|
||||
chatLog: ['你好呀', '下次来墨尔本告诉我'],
|
||||
},
|
||||
{
|
||||
id: '8',
|
||||
name: 'Tom Watanabe',
|
||||
gender: 'male',
|
||||
age: 34,
|
||||
occupation: '投资人',
|
||||
relationshipStatus: 'married',
|
||||
purpose: 'business',
|
||||
photos: [avatar('T', palette[7])],
|
||||
avatarColor: palette[7],
|
||||
bio: '东京天使投资人,关注东南亚消费与远程办公工具。常飞新加坡。',
|
||||
location: { country: '日本', countryCode: 'JP', city: '东京', lat: 35.6762, lng: 139.6503 },
|
||||
telegram: 'tomw_vc',
|
||||
tags: ['投资', '消费', '工具'],
|
||||
source: 'coffee',
|
||||
stage: 'second_meeting',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 1,
|
||||
notes: '二次见面后发 BP',
|
||||
chatLog: ['感兴趣你们的产品', '下周新加坡见面'],
|
||||
},
|
||||
{
|
||||
id: '9',
|
||||
name: '韩雪',
|
||||
gender: 'female',
|
||||
age: 25,
|
||||
occupation: '运营总监',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'both',
|
||||
photos: [avatar('韩', palette[1])],
|
||||
avatarColor: palette[1],
|
||||
bio: '深圳互联网运营,正在成都远程办公。想认识认真做事也认真生活的人。',
|
||||
location: { country: '中国', countryCode: 'CN', city: '成都', lat: 30.5728, lng: 104.0668 },
|
||||
phone: '13900139000',
|
||||
wechat: 'hanxue_ops',
|
||||
tags: ['运营', '增长', '美食'],
|
||||
source: 'campus',
|
||||
stage: 'chatting',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 2,
|
||||
notes: '',
|
||||
chatLog: ['火锅约起', '也聊聊业务增长'],
|
||||
},
|
||||
{
|
||||
id: '10',
|
||||
name: 'Sofia Mendes',
|
||||
gender: 'female',
|
||||
age: 28,
|
||||
occupation: '瑜伽教练',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('S', palette[3])],
|
||||
avatarColor: palette[3],
|
||||
bio: '巴西人,在乌布教瑜伽与冥想。热爱日出与素食料理。',
|
||||
location: { country: '印尼', countryCode: 'ID', city: '乌布', lat: -8.5069, lng: 115.2625 },
|
||||
telegram: 'sofiamendes',
|
||||
tags: ['瑜伽', '冥想', '素食'],
|
||||
source: 'offline',
|
||||
stage: 'interacting',
|
||||
starred: true,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 0,
|
||||
notes: '今天晨练见过',
|
||||
chatLog: ['早上好', '明天 sunrise class 见'],
|
||||
},
|
||||
{
|
||||
id: '11',
|
||||
name: '李明轩',
|
||||
gender: 'male',
|
||||
age: 30,
|
||||
occupation: '自由开发者',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'business',
|
||||
photos: [avatar('李', palette[6])],
|
||||
avatarColor: palette[6],
|
||||
bio: '全栈独立开发,做订阅制工具产品。常驻大理,找联合创始人。',
|
||||
location: { country: '中国', countryCode: 'CN', city: '大理', lat: 25.6065, lng: 100.2679 },
|
||||
wechat: 'mingxuan_dev',
|
||||
tags: ['独立开发', 'SaaS', '合伙'],
|
||||
source: 'youtube',
|
||||
stage: 'met',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 5,
|
||||
notes: '',
|
||||
chatLog: ['看了你的产品视频', '大理有个开发者局'],
|
||||
},
|
||||
{
|
||||
id: '12',
|
||||
name: 'Nina Vogt',
|
||||
gender: 'female',
|
||||
age: 24,
|
||||
occupation: '数字营销',
|
||||
relationshipStatus: 'single',
|
||||
purpose: 'dating',
|
||||
photos: [avatar('N', palette[2])],
|
||||
avatarColor: palette[2],
|
||||
bio: '柏林来的营销顾问,正在清迈休整三个月。喜欢骑摩托兜风。',
|
||||
location: { country: '泰国', countryCode: 'TH', city: '清迈', lat: 18.795, lng: 98.99 },
|
||||
telegram: 'ninavogt',
|
||||
tags: ['营销', '摩托', '旅居'],
|
||||
source: 'coffee',
|
||||
stage: 'chatting',
|
||||
starred: false,
|
||||
blacklisted: false,
|
||||
lastInteractionDays: 3,
|
||||
notes: '',
|
||||
chatLog: ['Ping 了一下', '推荐了旧城咖啡馆'],
|
||||
},
|
||||
]
|
||||
|
||||
export function clusterByCountry(contacts: Contact[]) {
|
||||
const map = new Map<string, Contact[]>()
|
||||
for (const c of contacts) {
|
||||
const key = c.location.country
|
||||
if (!map.has(key)) map.set(key, [])
|
||||
map.get(key)!.push(c)
|
||||
}
|
||||
return [...map.entries()].map(([country, list]) => {
|
||||
const lat = list.reduce((s, c) => s + c.location.lat, 0) / list.length
|
||||
const lng = list.reduce((s, c) => s + c.location.lng, 0) / list.length
|
||||
return {
|
||||
country,
|
||||
countryCode: list[0].location.countryCode,
|
||||
lat,
|
||||
lng,
|
||||
contacts: list,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function clusterByCity(contacts: Contact[]) {
|
||||
const map = new Map<string, Contact[]>()
|
||||
for (const c of contacts) {
|
||||
const key = c.location.city
|
||||
if (!map.has(key)) map.set(key, [])
|
||||
map.get(key)!.push(c)
|
||||
}
|
||||
return [...map.entries()].map(([city, list]) => {
|
||||
const lat = list.reduce((s, c) => s + c.location.lat, 0) / list.length
|
||||
const lng = list.reduce((s, c) => s + c.location.lng, 0) / list.length
|
||||
return { city, lat, lng, contacts: list }
|
||||
})
|
||||
}
|
||||
10
src/main.tsx
Normal file
@ -0,0 +1,10 @@
|
||||
import { StrictMode } from 'react'
|
||||
import { createRoot } from 'react-dom/client'
|
||||
import './styles/global.css'
|
||||
import App from './App'
|
||||
|
||||
createRoot(document.getElementById('root')!).render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>,
|
||||
)
|
||||
58
src/pages/DisguisePage.css
Normal file
@ -0,0 +1,58 @@
|
||||
.disguise-page {
|
||||
height: 100%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: #1c1c1e;
|
||||
padding: 24px;
|
||||
}
|
||||
|
||||
.disguise-calc {
|
||||
width: min(100%, 320px);
|
||||
background: #000;
|
||||
border-radius: 24px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
||||
}
|
||||
|
||||
.disguise-calc__screen {
|
||||
text-align: right;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 300;
|
||||
color: #fff;
|
||||
padding: 20px 8px 28px;
|
||||
font-family: ui-monospace, monospace;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.disguise-calc__grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.disguise-calc__key {
|
||||
aspect-ratio: 1;
|
||||
border-radius: 50%;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.disguise-calc__key:nth-child(4n) {
|
||||
background: #ff9f0a;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.disguise-calc__key:nth-child(4n-1):not(:nth-child(4)) {
|
||||
background: #a5a5a5;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.disguise-calc__hint {
|
||||
margin-top: 16px;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
color: #666;
|
||||
}
|
||||
58
src/pages/DisguisePage.tsx
Normal file
@ -0,0 +1,58 @@
|
||||
import { useState } from 'react'
|
||||
import type { ContactsApi } from '../store/useContacts'
|
||||
import './DisguisePage.css'
|
||||
|
||||
interface DisguisePageProps {
|
||||
api: ContactsApi
|
||||
}
|
||||
|
||||
/** 首页伪装 — 计算器外观,输入 PIN 后解锁 */
|
||||
export function DisguisePage({ api }: DisguisePageProps) {
|
||||
const [display, setDisplay] = useState('0')
|
||||
const [pinInput, setPinInput] = useState('')
|
||||
|
||||
const press = (v: string) => {
|
||||
if (v === 'C') {
|
||||
setDisplay('0')
|
||||
setPinInput('')
|
||||
return
|
||||
}
|
||||
if (v === '=') {
|
||||
if (api.unlock(pinInput)) return
|
||||
try {
|
||||
const result = Function(`"use strict"; return (${display})`)()
|
||||
setDisplay(String(result))
|
||||
} catch {
|
||||
setDisplay('Error')
|
||||
}
|
||||
setPinInput('')
|
||||
return
|
||||
}
|
||||
if (/^\d$/.test(v)) setPinInput((p) => p + v)
|
||||
if (['+', '-', '*', '/', '.'].includes(v) || /^\d$/.test(v)) {
|
||||
setDisplay((d) => {
|
||||
if (d === 'Error') return v === '.' ? '0.' : v
|
||||
if (d === '0' && v !== '.') return v
|
||||
return d + v
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const keys = ['7', '8', '9', 'C', '4', '5', '6', '/', '1', '2', '3', '*', '0', '.', '=', '-']
|
||||
|
||||
return (
|
||||
<div className="disguise-page">
|
||||
<div className="disguise-calc">
|
||||
<div className="disguise-calc__screen">{display}</div>
|
||||
<div className="disguise-calc__grid">
|
||||
{keys.map((k) => (
|
||||
<button key={k} type="button" className="disguise-calc__key" onClick={() => press(k)}>
|
||||
{k}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<p className="disguise-calc__hint">计算器 · 输入 PIN 后按 = 解锁</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
208
src/pages/MapPage.css
Normal file
@ -0,0 +1,208 @@
|
||||
.map-page {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* nomadro hub-navbar */
|
||||
.map-topbar {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 20;
|
||||
padding: 14px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
border-radius: 0;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
background: rgba(10, 14, 23, 0.85) !important;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border-bottom: var(--border-glass);
|
||||
}
|
||||
|
||||
.map-topbar__brand {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.map-topbar__brand h1 {
|
||||
font-family: var(--font-display);
|
||||
font-size: 1.35rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.03em;
|
||||
line-height: 1.1;
|
||||
}
|
||||
|
||||
.map-topbar__brand p {
|
||||
font-size: 11px;
|
||||
color: var(--text-secondary);
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.map-topbar__filters {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.map-topbar__filter-icon {
|
||||
color: var(--text-muted);
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.map-meta {
|
||||
position: absolute;
|
||||
top: 118px;
|
||||
left: 16px;
|
||||
z-index: 20;
|
||||
}
|
||||
|
||||
.map-breadcrumb {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 14px;
|
||||
border-radius: var(--radius-md);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: var(--font-display);
|
||||
}
|
||||
|
||||
.map-breadcrumb__back {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.map-breadcrumb__count {
|
||||
color: var(--accent-3);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.map-reminders {
|
||||
position: absolute;
|
||||
left: 16px;
|
||||
right: 16px;
|
||||
bottom: 48px;
|
||||
z-index: 20;
|
||||
border-radius: var(--radius-md);
|
||||
overflow: hidden;
|
||||
animation: reminderIn 0.45s ease;
|
||||
}
|
||||
|
||||
.map-reminders__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 10px 14px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.map-reminders__head i {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent-1);
|
||||
box-shadow: 0 0 10px rgba(255, 107, 107, 0.7);
|
||||
flex-shrink: 0;
|
||||
animation: pulseDot 1.6s ease-in-out infinite;
|
||||
}
|
||||
|
||||
.map-reminders__head span {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.map-reminders__head svg {
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.map-reminders__head svg.is-open {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.map-reminders__list {
|
||||
border-top: var(--border-glass);
|
||||
max-height: 160px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.map-reminders__list button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
padding: 8px 14px;
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.map-reminders__list button:active {
|
||||
background: rgba(78, 205, 196, 0.08);
|
||||
}
|
||||
|
||||
.map-reminders__list img {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 50%;
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
@keyframes pulseDot {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.35;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes reminderIn {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
}
|
||||
|
||||
.map-globe {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
}
|
||||
|
||||
.map-globe__vignette {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(10, 14, 23, 0.25) 0%,
|
||||
transparent 20%,
|
||||
transparent 75%,
|
||||
rgba(10, 14, 23, 0.5) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.map-hint {
|
||||
position: absolute;
|
||||
bottom: 16px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 20;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
pointer-events: none;
|
||||
font-family: var(--font-display);
|
||||
}
|
||||
126
src/pages/MapPage.tsx
Normal file
@ -0,0 +1,126 @@
|
||||
import { ChevronLeft, ChevronUp, Filter } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { NomadLogo } from '../components/Layout/NomadLogo'
|
||||
import type { ContactsApi } from '../store/useContacts'
|
||||
import { Globe2D } from '../components/Globe/Globe2D'
|
||||
import './MapPage.css'
|
||||
|
||||
interface MapPageProps {
|
||||
api: ContactsApi
|
||||
}
|
||||
|
||||
export function MapPage({ api }: MapPageProps) {
|
||||
const [remindersOpen, setRemindersOpen] = useState(false)
|
||||
|
||||
const {
|
||||
visible,
|
||||
focusCountry,
|
||||
focusCity,
|
||||
setFocusCountry,
|
||||
setFocusCity,
|
||||
setSelectedId,
|
||||
purposeFilter,
|
||||
setPurposeFilter,
|
||||
reminders,
|
||||
} = api
|
||||
|
||||
const breadcrumb = focusCity
|
||||
? `${focusCountry} · ${focusCity}`
|
||||
: focusCountry
|
||||
? focusCountry
|
||||
: '全球视野'
|
||||
|
||||
return (
|
||||
<div className="page map-page">
|
||||
<header className="map-topbar glass">
|
||||
<div className="map-topbar__brand">
|
||||
<NomadLogo size={32} />
|
||||
<div>
|
||||
<h1 className="gradient-text">NomadHub</h1>
|
||||
<p>数字游民人际操作系统</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="filter-bar map-topbar__filters">
|
||||
<Filter size={14} className="map-topbar__filter-icon" />
|
||||
{(
|
||||
[
|
||||
['all', '全部'],
|
||||
['business', '业务'],
|
||||
['dating', '约会'],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
className={`filter-chip ${purposeFilter === key ? 'is-active' : ''}`}
|
||||
onClick={() => setPurposeFilter(key)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div className="map-meta">
|
||||
<div className="map-breadcrumb glass">
|
||||
{(focusCountry || focusCity) && (
|
||||
<button
|
||||
type="button"
|
||||
className="map-breadcrumb__back"
|
||||
onClick={() => {
|
||||
if (focusCity) setFocusCity(null)
|
||||
else setFocusCountry(null)
|
||||
}}
|
||||
>
|
||||
<ChevronLeft size={16} />
|
||||
</button>
|
||||
)}
|
||||
<span>{breadcrumb}</span>
|
||||
<span className="map-breadcrumb__count">{visible.length} 人</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="map-globe">
|
||||
<Globe2D
|
||||
contacts={visible}
|
||||
focusCountry={focusCountry}
|
||||
focusCity={focusCity}
|
||||
onSelectCountry={(country) => {
|
||||
setFocusCountry(country)
|
||||
setFocusCity(null)
|
||||
}}
|
||||
onSelectCity={(city) => setFocusCity(city)}
|
||||
onSelectContact={(id) => setSelectedId(id)}
|
||||
/>
|
||||
<div className="map-globe__vignette" />
|
||||
</div>
|
||||
|
||||
{reminders.length > 0 && (
|
||||
<div className={`map-reminders glass ${remindersOpen ? 'is-open' : ''}`}>
|
||||
<button type="button" className="map-reminders__head" onClick={() => setRemindersOpen(!remindersOpen)}>
|
||||
<i />
|
||||
<span>
|
||||
{reminders.length} 人待跟进 · {reminders[0].name} 已 {reminders[0].lastInteractionDays} 天未互动
|
||||
</span>
|
||||
<ChevronUp size={16} className={remindersOpen ? 'is-open' : ''} />
|
||||
</button>
|
||||
{remindersOpen && (
|
||||
<div className="map-reminders__list">
|
||||
{reminders.map((c) => (
|
||||
<button key={c.id} type="button" onClick={() => setSelectedId(c.id)}>
|
||||
<img src={c.photos[0]} alt={c.name} />
|
||||
<span>
|
||||
{c.name} · {c.lastInteractionDays} 天未互动
|
||||
</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<p className="map-hint">拖动旋转 · 滚轮/双指缩放 · 点击进入</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
32
src/pages/PeoplePage.css
Normal file
@ -0,0 +1,32 @@
|
||||
.people-page {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.people-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.people-row__head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.people-row__head em {
|
||||
font-style: normal;
|
||||
font-weight: 500;
|
||||
font-size: 0.85rem;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.people-row__star {
|
||||
color: var(--text-muted);
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
.people-row__star.is-on {
|
||||
color: var(--accent-2);
|
||||
}
|
||||
132
src/pages/PeoplePage.tsx
Normal file
@ -0,0 +1,132 @@
|
||||
import { LayoutGrid, List, Plus, Star } from 'lucide-react'
|
||||
import { useState } from 'react'
|
||||
import { ContactFilterPanel } from '../components/Filters/ContactFilterPanel'
|
||||
import { PageHeader } from '../components/Layout/PageHeader'
|
||||
import { AddContactForm } from '../components/People/AddContactForm'
|
||||
import { SwipeDeck } from '../components/People/SwipeDeck'
|
||||
import type { ContactsApi } from '../store/useContacts'
|
||||
import { SOURCE_LABELS, STAGE_LABELS } from '../types/contact'
|
||||
import './PeoplePage.css'
|
||||
|
||||
interface PeoplePageProps {
|
||||
api: ContactsApi
|
||||
}
|
||||
|
||||
type ViewMode = 'cards' | 'list'
|
||||
|
||||
export function PeoplePage({ api }: PeoplePageProps) {
|
||||
const [view, setView] = useState<ViewMode>('cards')
|
||||
const [showAdd, setShowAdd] = useState(false)
|
||||
|
||||
const {
|
||||
peopleFiltered,
|
||||
setSelectedId,
|
||||
peopleFilters,
|
||||
patchPeopleFilters,
|
||||
resetPeopleFilters,
|
||||
peopleListFilter,
|
||||
setPeopleListFilter,
|
||||
occupations,
|
||||
toggleStar,
|
||||
blacklist,
|
||||
addContact,
|
||||
} = api
|
||||
|
||||
const sorted = [...peopleFiltered].sort((a, b) => {
|
||||
if (a.starred !== b.starred) return a.starred ? -1 : 1
|
||||
return a.lastInteractionDays - b.lastInteractionDays
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="page people-page">
|
||||
<PageHeader
|
||||
title="人脉 People"
|
||||
subtitle="业务人脉与约会对象 · Tinder 卡片 + 多维度跟踪"
|
||||
count={sorted.length}
|
||||
actions={
|
||||
<>
|
||||
<button type="button" className="hub-icon-btn" onClick={() => setShowAdd(true)} title="添加">
|
||||
<Plus size={18} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`hub-icon-btn ${view === 'cards' ? 'is-on' : ''}`}
|
||||
onClick={() => setView('cards')}
|
||||
title="卡片"
|
||||
>
|
||||
<LayoutGrid size={18} />
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className={`hub-icon-btn ${view === 'list' ? 'is-on' : ''}`}
|
||||
onClick={() => setView('list')}
|
||||
title="列表"
|
||||
>
|
||||
<List size={18} />
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
>
|
||||
<ContactFilterPanel
|
||||
filters={peopleFilters}
|
||||
occupations={occupations}
|
||||
onChange={patchPeopleFilters}
|
||||
onReset={resetPeopleFilters}
|
||||
listFilter={peopleListFilter}
|
||||
onListFilterChange={setPeopleListFilter}
|
||||
showListFilter
|
||||
/>
|
||||
</PageHeader>
|
||||
|
||||
{view === 'cards' ? (
|
||||
<SwipeDeck
|
||||
contacts={sorted}
|
||||
onOpen={setSelectedId}
|
||||
onStar={toggleStar}
|
||||
onBlacklist={blacklist}
|
||||
/>
|
||||
) : (
|
||||
<div className="page-body scroll-y people-list">
|
||||
{sorted.length === 0 && <p className="hub-empty">没有符合筛选条件的人脉</p>}
|
||||
{sorted.map((c) => (
|
||||
<button key={c.id} type="button" className="hub-list-row people-row" onClick={() => setSelectedId(c.id)}>
|
||||
<img src={c.photos[0]} alt={c.name} />
|
||||
<div className="hub-list-row__body">
|
||||
<div className="people-row__head">
|
||||
<span className="hub-list-row__title">
|
||||
{c.name} <em>{c.age}</em>
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className={`people-row__star ${c.starred ? 'is-on' : ''}`}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation()
|
||||
toggleStar(c.id)
|
||||
}}
|
||||
>
|
||||
<Star size={14} fill={c.starred ? 'currentColor' : 'none'} />
|
||||
</button>
|
||||
</div>
|
||||
<p className="hub-list-row__sub">
|
||||
{c.occupation} · {c.location.city}
|
||||
</p>
|
||||
<div className="hub-tags">
|
||||
<span className={`hub-tag hub-tag--${c.purpose}`}>
|
||||
{c.purpose === 'business' ? '业务' : c.purpose === 'dating' ? '约会' : '双栖'}
|
||||
</span>
|
||||
<span className="hub-tag">{STAGE_LABELS[c.stage]}</span>
|
||||
<span className="hub-tag">{SOURCE_LABELS[c.source]}</span>
|
||||
{c.lastInteractionDays >= 5 && (
|
||||
<span className="hub-tag hub-tag--warn">{c.lastInteractionDays}天未互动</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{showAdd && <AddContactForm onClose={() => setShowAdd(false)} onSave={addContact} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
65
src/pages/RosterPage.css
Normal file
@ -0,0 +1,65 @@
|
||||
.roster-page {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.roster-view-bar {
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.roster-content {
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
.roster-section {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.roster-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.occ-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.occ-card {
|
||||
text-align: left;
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.occ-card strong {
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.88rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.occ-card__count {
|
||||
font-size: 11px;
|
||||
color: var(--accent-3);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.occ-avatars {
|
||||
display: flex;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.occ-avatars img {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid var(--bg-primary);
|
||||
margin-left: -6px;
|
||||
}
|
||||
|
||||
.occ-avatars img:first-child {
|
||||
margin-left: 0;
|
||||
}
|
||||
156
src/pages/RosterPage.tsx
Normal file
@ -0,0 +1,156 @@
|
||||
import { useMemo } from 'react'
|
||||
import { ContactFilterPanel } from '../components/Filters/ContactFilterPanel'
|
||||
import { PageHeader } from '../components/Layout/PageHeader'
|
||||
import type { ContactsApi } from '../store/useContacts'
|
||||
import type { RosterViewFilter } from '../types/filters'
|
||||
import './RosterPage.css'
|
||||
|
||||
interface RosterPageProps {
|
||||
api: ContactsApi
|
||||
}
|
||||
|
||||
const VIEW_OPTIONS: { key: RosterViewFilter; label: string }[] = [
|
||||
{ key: 'all', label: '全部' },
|
||||
{ key: 'coffee', label: 'Coffeechat' },
|
||||
{ key: 'resume', label: '简历库' },
|
||||
]
|
||||
|
||||
export function RosterPage({ api }: RosterPageProps) {
|
||||
const {
|
||||
rosterFiltered,
|
||||
setSelectedId,
|
||||
rosterFilters,
|
||||
patchRosterFilters,
|
||||
resetRosterFilters,
|
||||
occupations,
|
||||
rosterViewFilter,
|
||||
setRosterViewFilter,
|
||||
} = api
|
||||
|
||||
const byOccupation = useMemo(() => {
|
||||
const map = new Map<string, typeof rosterFiltered>()
|
||||
for (const c of rosterFiltered) {
|
||||
if (!map.has(c.occupation)) map.set(c.occupation, [])
|
||||
map.get(c.occupation)!.push(c)
|
||||
}
|
||||
return [...map.entries()].sort((a, b) => b[1].length - a[1].length)
|
||||
}, [rosterFiltered])
|
||||
|
||||
const coffeeList = useMemo(
|
||||
() => rosterFiltered.filter((c) => c.stage === 'interacting' || c.stage === 'meeting'),
|
||||
[rosterFiltered],
|
||||
)
|
||||
|
||||
const resumePool = useMemo(
|
||||
() => rosterFiltered.filter((c) => c.purpose === 'business' || c.purpose === 'both'),
|
||||
[rosterFiltered],
|
||||
)
|
||||
|
||||
const showOcc = rosterViewFilter === 'all'
|
||||
const showCoffee = rosterViewFilter === 'all' || rosterViewFilter === 'coffee'
|
||||
const showResume = rosterViewFilter === 'all' || rosterViewFilter === 'resume'
|
||||
|
||||
return (
|
||||
<div className="page roster-page">
|
||||
<PageHeader title="花名册 Roster" subtitle="职业库 · Coffeechat · 招募助理 / 简历库" count={rosterFiltered.length}>
|
||||
<ContactFilterPanel
|
||||
filters={rosterFilters}
|
||||
occupations={occupations}
|
||||
onChange={patchRosterFilters}
|
||||
onReset={resetRosterFilters}
|
||||
/>
|
||||
<div className="filter-bar filter-bar--secondary roster-view-bar">
|
||||
{VIEW_OPTIONS.map(({ key, label }) => (
|
||||
<button
|
||||
key={key}
|
||||
type="button"
|
||||
className={`filter-chip filter-chip--ghost ${rosterViewFilter === key ? 'is-active' : ''}`}
|
||||
onClick={() => setRosterViewFilter(key)}
|
||||
>
|
||||
{label}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</PageHeader>
|
||||
|
||||
<div className="page-body scroll-y roster-content">
|
||||
{showOcc && (
|
||||
<section className="roster-section">
|
||||
<h2 className="hub-section-title">💼 职业库</h2>
|
||||
{byOccupation.length === 0 ? (
|
||||
<p className="hub-empty">暂无数据</p>
|
||||
) : (
|
||||
<div className="occ-grid">
|
||||
{byOccupation.map(([occ, list]) => (
|
||||
<button
|
||||
key={occ}
|
||||
type="button"
|
||||
className="hub-portal-card hub-portal-card--accent occ-card"
|
||||
onClick={() => setSelectedId(list[0].id)}
|
||||
>
|
||||
<strong>{occ}</strong>
|
||||
<span className="occ-card__count">{list.length} 人</span>
|
||||
<div className="occ-avatars">
|
||||
{list.slice(0, 3).map((c) => (
|
||||
<img key={c.id} src={c.photos[0]} alt={c.name} />
|
||||
))}
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{showCoffee && (
|
||||
<section className="roster-section">
|
||||
<h2 className="hub-section-title">☕ Coffeechat 候选</h2>
|
||||
{coffeeList.length === 0 ? (
|
||||
<p className="hub-empty">暂无候选</p>
|
||||
) : (
|
||||
<div className="roster-list">
|
||||
{coffeeList.map((c) => (
|
||||
<button key={c.id} type="button" className="hub-list-row" onClick={() => setSelectedId(c.id)}>
|
||||
<img src={c.photos[0]} alt={c.name} />
|
||||
<div className="hub-list-row__body">
|
||||
<div className="hub-list-row__title">{c.name}</div>
|
||||
<p className="hub-list-row__sub">
|
||||
{c.location.city} · {c.occupation}
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{showResume && (
|
||||
<section className="roster-section">
|
||||
<h2 className="hub-section-title">📋 招募助理 · 简历库</h2>
|
||||
{resumePool.length === 0 ? (
|
||||
<p className="hub-empty">暂无简历</p>
|
||||
) : (
|
||||
<div className="roster-list">
|
||||
{resumePool.map((c) => (
|
||||
<button
|
||||
key={c.id}
|
||||
type="button"
|
||||
className="hub-list-row hub-portal-card--teal"
|
||||
onClick={() => setSelectedId(c.id)}
|
||||
>
|
||||
<img src={c.photos[0]} alt={c.name} />
|
||||
<div className="hub-list-row__body">
|
||||
<div className="hub-list-row__title">{c.name}</div>
|
||||
<p className="hub-list-row__sub">{c.occupation}</p>
|
||||
</div>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
95
src/pages/SettingsPage.css
Normal file
@ -0,0 +1,95 @@
|
||||
.settings-page {
|
||||
padding-top: 4px;
|
||||
}
|
||||
|
||||
.settings-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding-bottom: 24px;
|
||||
}
|
||||
|
||||
.settings-section__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.95rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.settings-section__desc {
|
||||
font-size: 12px;
|
||||
color: var(--text-secondary);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.settings-toggle {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.settings-pin {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.settings-pin .hub-input {
|
||||
flex: 1;
|
||||
letter-spacing: 0.2em;
|
||||
}
|
||||
|
||||
.settings-lock-btn {
|
||||
margin-top: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.settings-row {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.settings-meta {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
color: var(--accent-3);
|
||||
}
|
||||
|
||||
.settings-blacklist {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.settings-bl-row {
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.settings-bl-row .hub-list-row__title {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.settings-reminder {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
padding: 6px 0;
|
||||
}
|
||||
|
||||
.settings-reminder i {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: var(--accent-1);
|
||||
flex-shrink: 0;
|
||||
box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
|
||||
}
|
||||
126
src/pages/SettingsPage.tsx
Normal file
@ -0,0 +1,126 @@
|
||||
import { Download, Eye, EyeOff, Lock, Shield, Upload, UserX } from 'lucide-react'
|
||||
import { useRef, useState } from 'react'
|
||||
import { PageHeader } from '../components/Layout/PageHeader'
|
||||
import type { ContactsApi } from '../store/useContacts'
|
||||
import './SettingsPage.css'
|
||||
|
||||
interface SettingsPageProps {
|
||||
api: ContactsApi
|
||||
}
|
||||
|
||||
export function SettingsPage({ api }: SettingsPageProps) {
|
||||
const fileRef = useRef<HTMLInputElement>(null)
|
||||
const [pinDraft, setPinDraft] = useState(api.settings.pin)
|
||||
const [showPin, setShowPin] = useState(false)
|
||||
|
||||
return (
|
||||
<div className="page settings-page">
|
||||
<PageHeader title="设置" subtitle="首页伪装 · 加密 · 数据管理" />
|
||||
|
||||
<div className="page-body scroll-y settings-content">
|
||||
<section className="hub-card settings-section">
|
||||
<h2 className="settings-section__title">
|
||||
<Shield size={16} /> 首页伪装
|
||||
</h2>
|
||||
<p className="settings-section__desc">开启后启动显示计算器,输入 PIN 按 = 解锁</p>
|
||||
<label className="settings-toggle">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={api.settings.disguiseEnabled}
|
||||
onChange={(e) => api.setDisguise(e.target.checked)}
|
||||
/>
|
||||
<span>{api.settings.disguiseEnabled ? '已开启' : '已关闭'}</span>
|
||||
</label>
|
||||
</section>
|
||||
|
||||
<section className="hub-card settings-section">
|
||||
<h2 className="settings-section__title">
|
||||
<Lock size={16} /> 加密 PIN
|
||||
</h2>
|
||||
<p className="settings-section__desc">4-6 位数字 PIN,伪装模式下解锁用</p>
|
||||
<div className="settings-pin">
|
||||
<input
|
||||
className="hub-input"
|
||||
type={showPin ? 'text' : 'password'}
|
||||
inputMode="numeric"
|
||||
maxLength={6}
|
||||
placeholder="设置 PIN"
|
||||
value={pinDraft}
|
||||
onChange={(e) => setPinDraft(e.target.value.replace(/\D/g, ''))}
|
||||
/>
|
||||
<button type="button" className="hub-icon-btn" onClick={() => setShowPin(!showPin)}>
|
||||
{showPin ? <EyeOff size={18} /> : <Eye size={18} />}
|
||||
</button>
|
||||
<button type="button" className="hub-btn hub-btn--primary" onClick={() => api.setPin(pinDraft)}>
|
||||
保存
|
||||
</button>
|
||||
</div>
|
||||
{api.settings.disguiseEnabled && (
|
||||
<button type="button" className="hub-btn hub-btn--ghost settings-lock-btn" onClick={() => api.lock()}>
|
||||
立即锁定
|
||||
</button>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="hub-card settings-section">
|
||||
<h2 className="settings-section__title">
|
||||
<Download size={16} /> SQLite 数据 · 导入/导出
|
||||
</h2>
|
||||
<p className="settings-section__desc">JSON 格式备份人脉数据库</p>
|
||||
<div className="settings-row">
|
||||
<button type="button" className="hub-btn hub-btn--primary" onClick={() => api.exportData()}>
|
||||
<Download size={16} /> 导出
|
||||
</button>
|
||||
<button type="button" className="hub-btn hub-btn--ghost" onClick={() => fileRef.current?.click()}>
|
||||
<Upload size={16} /> 导入
|
||||
</button>
|
||||
<input
|
||||
ref={fileRef}
|
||||
type="file"
|
||||
accept=".json,application/json"
|
||||
hidden
|
||||
onChange={(e) => {
|
||||
const f = e.target.files?.[0]
|
||||
if (f) api.importData(f)
|
||||
e.target.value = ''
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<p className="settings-meta">{api.contacts.length} 条记录 · 本地 localStorage 存储</p>
|
||||
</section>
|
||||
|
||||
<section className="hub-card settings-section">
|
||||
<h2 className="settings-section__title">
|
||||
<UserX size={16} /> 黑名单 ({api.blacklisted.length})
|
||||
</h2>
|
||||
{api.blacklisted.length === 0 ? (
|
||||
<p className="hub-empty">暂无黑名单</p>
|
||||
) : (
|
||||
<div className="settings-blacklist">
|
||||
{api.blacklisted.map((c) => (
|
||||
<div key={c.id} className="hub-list-row settings-bl-row">
|
||||
<img src={c.photos[0]} alt={c.name} />
|
||||
<span className="hub-list-row__title">{c.name}</span>
|
||||
<button type="button" className="hub-btn hub-btn--teal" onClick={() => api.restoreContact(c.id)}>
|
||||
恢复
|
||||
</button>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
|
||||
{api.reminders.length > 0 && (
|
||||
<section className="hub-card hub-portal-card--accent settings-section">
|
||||
<h2 className="settings-section__title">🔔 自动提醒</h2>
|
||||
{api.reminders.map((c) => (
|
||||
<p key={c.id} className="settings-reminder">
|
||||
<i /> {c.name} 已 {c.lastInteractionDays} 天没有互动
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
275
src/store/useContacts.ts
Normal file
@ -0,0 +1,275 @@
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { MOCK_CONTACTS } from '../data/mockContacts'
|
||||
import type { Contact, RelationshipStage } from '../types/contact'
|
||||
import {
|
||||
DEFAULT_FILTERS,
|
||||
type ContactFilters,
|
||||
type PeopleListFilter,
|
||||
type PurposeFilter,
|
||||
type RosterViewFilter,
|
||||
} from '../types/filters'
|
||||
import { applyContactFilters, applyPeopleListFilter } from '../utils/applyFilters'
|
||||
|
||||
const STORAGE_KEY = 'nomadhub-contacts-v1'
|
||||
const SETTINGS_KEY = 'nomadhub-settings-v1'
|
||||
|
||||
interface AppSettings {
|
||||
disguiseEnabled: boolean
|
||||
pin: string
|
||||
unlocked: boolean
|
||||
}
|
||||
|
||||
function loadContacts(): Contact[] {
|
||||
try {
|
||||
const raw = localStorage.getItem(STORAGE_KEY)
|
||||
if (raw) return JSON.parse(raw) as Contact[]
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return MOCK_CONTACTS
|
||||
}
|
||||
|
||||
function loadSettings(): AppSettings {
|
||||
try {
|
||||
const raw = localStorage.getItem(SETTINGS_KEY)
|
||||
if (raw) return JSON.parse(raw) as AppSettings
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
return { disguiseEnabled: false, pin: '', unlocked: true }
|
||||
}
|
||||
|
||||
function saveContacts(contacts: Contact[]) {
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(contacts))
|
||||
}
|
||||
|
||||
function saveSettings(s: AppSettings) {
|
||||
localStorage.setItem(SETTINGS_KEY, JSON.stringify(s))
|
||||
}
|
||||
|
||||
export type { PurposeFilter, PeopleListFilter, RosterViewFilter, ContactFilters }
|
||||
|
||||
export function useContacts() {
|
||||
const [contacts, setContacts] = useState<Contact[]>(loadContacts)
|
||||
const [settings, setSettings] = useState<AppSettings>(loadSettings)
|
||||
const [peopleFilters, setPeopleFilters] = useState<ContactFilters>({ ...DEFAULT_FILTERS })
|
||||
const [rosterFilters, setRosterFilters] = useState<ContactFilters>({ ...DEFAULT_FILTERS })
|
||||
const [peopleListFilter, setPeopleListFilter] = useState<PeopleListFilter>('all')
|
||||
const [rosterViewFilter, setRosterViewFilter] = useState<RosterViewFilter>('all')
|
||||
const [selectedId, setSelectedId] = useState<string | null>(null)
|
||||
const [focusCountry, setFocusCountry] = useState<string | null>(null)
|
||||
const [focusCity, setFocusCity] = useState<string | null>(null)
|
||||
|
||||
// map page shares purpose from peopleFilters for consistency
|
||||
const purposeFilter = peopleFilters.purpose
|
||||
const setPurposeFilter = useCallback((p: PurposeFilter) => {
|
||||
setPeopleFilters((f) => ({ ...f, purpose: p }))
|
||||
setRosterFilters((f) => ({ ...f, purpose: p }))
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
saveContacts(contacts)
|
||||
}, [contacts])
|
||||
|
||||
useEffect(() => {
|
||||
saveSettings(settings)
|
||||
}, [settings])
|
||||
|
||||
const occupations = useMemo(() => {
|
||||
const set = new Set(contacts.filter((c) => !c.blacklisted).map((c) => c.occupation))
|
||||
return ['all', ...[...set].sort()]
|
||||
}, [contacts])
|
||||
|
||||
const peopleFiltered = useMemo(() => {
|
||||
const base = applyContactFilters(contacts, peopleFilters)
|
||||
return applyPeopleListFilter(base, peopleListFilter)
|
||||
}, [contacts, peopleFilters, peopleListFilter])
|
||||
|
||||
const rosterFiltered = useMemo(
|
||||
() => applyContactFilters(contacts, rosterFilters),
|
||||
[contacts, rosterFilters],
|
||||
)
|
||||
|
||||
const filtered = peopleFiltered
|
||||
const visible = useMemo(() => {
|
||||
let list = applyContactFilters(contacts, peopleFilters)
|
||||
if (focusCountry) list = list.filter((c) => c.location.country === focusCountry)
|
||||
if (focusCity) list = list.filter((c) => c.location.city === focusCity)
|
||||
return list
|
||||
}, [contacts, peopleFilters, focusCountry, focusCity])
|
||||
|
||||
const selected = useMemo(
|
||||
() => contacts.find((c) => c.id === selectedId) ?? null,
|
||||
[contacts, selectedId],
|
||||
)
|
||||
|
||||
const blacklisted = useMemo(() => contacts.filter((c) => c.blacklisted), [contacts])
|
||||
|
||||
const reminders = useMemo(
|
||||
() =>
|
||||
applyContactFilters(contacts, DEFAULT_FILTERS)
|
||||
.filter((c) => c.lastInteractionDays >= 5)
|
||||
.sort((a, b) => b.lastInteractionDays - a.lastInteractionDays),
|
||||
[contacts],
|
||||
)
|
||||
|
||||
const updateContact = useCallback((id: string, patch: Partial<Contact>) => {
|
||||
setContacts((prev) => prev.map((c) => (c.id === id ? { ...c, ...patch } : c)))
|
||||
}, [])
|
||||
|
||||
const toggleStar = useCallback((id: string) => {
|
||||
setContacts((prev) =>
|
||||
prev.map((c) => (c.id === id ? { ...c, starred: !c.starred } : c)),
|
||||
)
|
||||
}, [])
|
||||
|
||||
const blacklist = useCallback((id: string) => {
|
||||
setContacts((prev) =>
|
||||
prev.map((c) => (c.id === id ? { ...c, blacklisted: true, starred: false } : c)),
|
||||
)
|
||||
setSelectedId(null)
|
||||
}, [])
|
||||
|
||||
const restoreContact = useCallback((id: string) => {
|
||||
setContacts((prev) =>
|
||||
prev.map((c) => (c.id === id ? { ...c, blacklisted: false } : c)),
|
||||
)
|
||||
}, [])
|
||||
|
||||
const setStage = useCallback((id: string, stage: RelationshipStage) => {
|
||||
setContacts((prev) =>
|
||||
prev.map((c) => (c.id === id ? { ...c, stage, lastInteractionDays: 0 } : c)),
|
||||
)
|
||||
}, [])
|
||||
|
||||
const markInteraction = useCallback((id: string, note?: string) => {
|
||||
setContacts((prev) =>
|
||||
prev.map((c) => {
|
||||
if (c.id !== id) return c
|
||||
const chatLog = note ? [...c.chatLog, note] : c.chatLog
|
||||
return { ...c, lastInteractionDays: 0, chatLog }
|
||||
}),
|
||||
)
|
||||
}, [])
|
||||
|
||||
const addChatLog = useCallback((id: string, text: string) => {
|
||||
if (!text.trim()) return
|
||||
setContacts((prev) =>
|
||||
prev.map((c) =>
|
||||
c.id === id ? { ...c, chatLog: [...c.chatLog, text.trim()], lastInteractionDays: 0 } : c,
|
||||
),
|
||||
)
|
||||
}, [])
|
||||
|
||||
const exportData = useCallback(() => {
|
||||
const blob = new Blob([JSON.stringify(contacts, null, 2)], { type: 'application/json' })
|
||||
const url = URL.createObjectURL(blob)
|
||||
const a = document.createElement('a')
|
||||
a.href = url
|
||||
a.download = `nomadhub-export-${new Date().toISOString().slice(0, 10)}.json`
|
||||
a.click()
|
||||
URL.revokeObjectURL(url)
|
||||
}, [contacts])
|
||||
|
||||
const importData = useCallback((file: File) => {
|
||||
const reader = new FileReader()
|
||||
reader.onload = () => {
|
||||
try {
|
||||
const data = JSON.parse(reader.result as string) as Contact[]
|
||||
if (Array.isArray(data) && data.length) setContacts(data)
|
||||
} catch {
|
||||
alert('导入失败:文件格式不正确')
|
||||
}
|
||||
}
|
||||
reader.readAsText(file)
|
||||
}, [])
|
||||
|
||||
const setDisguise = useCallback((enabled: boolean) => {
|
||||
setSettings((s) => ({ ...s, disguiseEnabled: enabled, unlocked: !enabled }))
|
||||
}, [])
|
||||
|
||||
const setPin = useCallback((pin: string) => {
|
||||
setSettings((s) => ({ ...s, pin }))
|
||||
}, [])
|
||||
|
||||
const unlock = useCallback((pin: string) => {
|
||||
if (pin === settings.pin || !settings.pin) {
|
||||
setSettings((s) => ({ ...s, unlocked: true }))
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}, [settings.pin])
|
||||
|
||||
const lock = useCallback(() => {
|
||||
if (settings.disguiseEnabled) setSettings((s) => ({ ...s, unlocked: false }))
|
||||
}, [settings.disguiseEnabled])
|
||||
|
||||
const resetFocus = useCallback(() => {
|
||||
setFocusCountry(null)
|
||||
setFocusCity(null)
|
||||
}, [])
|
||||
|
||||
const patchPeopleFilters = useCallback((patch: Partial<ContactFilters>) => {
|
||||
setPeopleFilters((f) => ({ ...f, ...patch }))
|
||||
}, [])
|
||||
|
||||
const patchRosterFilters = useCallback((patch: Partial<ContactFilters>) => {
|
||||
setRosterFilters((f) => ({ ...f, ...patch }))
|
||||
}, [])
|
||||
|
||||
const resetPeopleFilters = useCallback(() => setPeopleFilters({ ...DEFAULT_FILTERS }), [])
|
||||
const resetRosterFilters = useCallback(() => setRosterFilters({ ...DEFAULT_FILTERS }), [])
|
||||
|
||||
const addContact = useCallback((data: Omit<Contact, 'id'>) => {
|
||||
const id = `c-${Date.now()}`
|
||||
setContacts((prev) => [{ ...data, id }, ...prev])
|
||||
}, [])
|
||||
|
||||
return {
|
||||
contacts,
|
||||
filtered,
|
||||
peopleFiltered,
|
||||
rosterFiltered,
|
||||
visible,
|
||||
selected,
|
||||
selectedId,
|
||||
setSelectedId,
|
||||
purposeFilter,
|
||||
setPurposeFilter,
|
||||
peopleFilters,
|
||||
patchPeopleFilters,
|
||||
resetPeopleFilters,
|
||||
rosterFilters,
|
||||
patchRosterFilters,
|
||||
resetRosterFilters,
|
||||
peopleListFilter,
|
||||
setPeopleListFilter,
|
||||
rosterViewFilter,
|
||||
setRosterViewFilter,
|
||||
occupations,
|
||||
focusCountry,
|
||||
setFocusCountry,
|
||||
focusCity,
|
||||
setFocusCity,
|
||||
resetFocus,
|
||||
updateContact,
|
||||
toggleStar,
|
||||
blacklist,
|
||||
restoreContact,
|
||||
blacklisted,
|
||||
setStage,
|
||||
markInteraction,
|
||||
addChatLog,
|
||||
reminders,
|
||||
settings,
|
||||
setDisguise,
|
||||
setPin,
|
||||
unlock,
|
||||
lock,
|
||||
exportData,
|
||||
importData,
|
||||
addContact,
|
||||
}
|
||||
}
|
||||
|
||||
export type ContactsApi = ReturnType<typeof useContacts>
|
||||
425
src/styles/global.css
Normal file
@ -0,0 +1,425 @@
|
||||
/* nomadro hub design system */
|
||||
:root {
|
||||
--bg-primary: #0a0e17;
|
||||
--bg-secondary: #111827;
|
||||
--bg-card: rgba(17, 24, 39, 0.7);
|
||||
--bg-glass: rgba(255, 255, 255, 0.05);
|
||||
--text-primary: #f1f5f9;
|
||||
--text-secondary: #94a3b8;
|
||||
--text-muted: #64748b;
|
||||
--accent-1: #ff6b6b;
|
||||
--accent-2: #ffe66d;
|
||||
--accent-3: #4ecdc4;
|
||||
--gradient-main: linear-gradient(135deg, #ff6b6b, #ffe66d, #4ecdc4);
|
||||
--gradient-text: linear-gradient(135deg, #ff6b6b 0%, #ffe66d 50%, #4ecdc4 100%);
|
||||
--shadow-glow: 0 0 40px rgba(78, 205, 196, 0.15);
|
||||
--shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
--border-glass: 1px solid rgba(255, 255, 255, 0.08);
|
||||
--radius-sm: 8px;
|
||||
--radius-md: 16px;
|
||||
--radius-lg: 24px;
|
||||
--nav-h: 68px;
|
||||
--safe-bottom: env(safe-area-inset-bottom, 0px);
|
||||
--transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
--font-display: 'Outfit', 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
|
||||
--font-body: 'Noto Sans SC', 'Outfit', 'PingFang SC', 'Microsoft YaHei', sans-serif;
|
||||
}
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
#root {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: var(--font-body);
|
||||
background: var(--bg-primary);
|
||||
color: var(--text-primary);
|
||||
line-height: 1.6;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
button {
|
||||
font-family: inherit;
|
||||
border: none;
|
||||
background: none;
|
||||
color: inherit;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* ── Typography ── */
|
||||
.gradient-text {
|
||||
background: var(--gradient-text);
|
||||
background-size: 200% auto;
|
||||
-webkit-background-clip: text;
|
||||
background-clip: text;
|
||||
color: transparent;
|
||||
animation: gradientShift 4s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes gradientShift {
|
||||
0%,
|
||||
100% {
|
||||
background-position: 0% center;
|
||||
}
|
||||
50% {
|
||||
background-position: 100% center;
|
||||
}
|
||||
}
|
||||
|
||||
/* ── Glass / Cards ── */
|
||||
.glass {
|
||||
background: var(--bg-card);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border: var(--border-glass);
|
||||
box-shadow: var(--shadow-card);
|
||||
}
|
||||
|
||||
.hub-card {
|
||||
padding: 14px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(18px);
|
||||
-webkit-backdrop-filter: blur(18px);
|
||||
box-shadow: var(--shadow-card);
|
||||
transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
|
||||
}
|
||||
|
||||
.hub-card:active {
|
||||
transform: translateY(-2px);
|
||||
border-color: rgba(78, 205, 196, 0.35);
|
||||
box-shadow: var(--shadow-glow), var(--shadow-card);
|
||||
}
|
||||
|
||||
.hub-portal-card {
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
backdrop-filter: blur(18px);
|
||||
box-shadow: var(--shadow-card);
|
||||
transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
|
||||
}
|
||||
|
||||
.hub-portal-card--accent {
|
||||
background: linear-gradient(160deg, rgba(255, 107, 107, 0.12), rgba(78, 205, 196, 0.08)), var(--bg-card);
|
||||
border-color: rgba(255, 107, 107, 0.22);
|
||||
}
|
||||
|
||||
.hub-portal-card--teal {
|
||||
background: linear-gradient(150deg, rgba(78, 205, 196, 0.14), rgba(167, 139, 250, 0.1)), var(--bg-card);
|
||||
border-color: rgba(78, 205, 196, 0.28);
|
||||
}
|
||||
|
||||
/* ── List rows ── */
|
||||
.hub-list-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
text-align: left;
|
||||
padding: 12px 14px;
|
||||
border-radius: var(--radius-md);
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(18px);
|
||||
box-shadow: var(--shadow-card);
|
||||
transition: transform 0.15s ease, border-color var(--transition), box-shadow var(--transition);
|
||||
}
|
||||
|
||||
.hub-list-row:active {
|
||||
transform: translateY(-2px);
|
||||
border-color: rgba(78, 205, 196, 0.35);
|
||||
box-shadow: var(--shadow-glow), var(--shadow-card);
|
||||
}
|
||||
|
||||
.hub-list-row img,
|
||||
.hub-list-row__avatar {
|
||||
width: 44px;
|
||||
height: 44px;
|
||||
border-radius: 12px;
|
||||
object-fit: cover;
|
||||
flex-shrink: 0;
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.hub-list-row__body {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.hub-list-row__title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.95rem;
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
}
|
||||
|
||||
.hub-list-row__sub {
|
||||
margin-top: 2px;
|
||||
font-size: 0.78rem;
|
||||
color: var(--text-secondary);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
/* ── Tags / Pills ── */
|
||||
.hub-tag {
|
||||
font-size: 10px;
|
||||
padding: 3px 9px;
|
||||
border-radius: 999px;
|
||||
background: var(--bg-glass);
|
||||
color: var(--text-muted);
|
||||
border: var(--border-glass);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.hub-tag--business {
|
||||
color: var(--accent-3);
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
border-color: rgba(78, 205, 196, 0.2);
|
||||
}
|
||||
|
||||
.hub-tag--dating {
|
||||
color: var(--accent-1);
|
||||
background: rgba(255, 107, 107, 0.12);
|
||||
border-color: rgba(255, 107, 107, 0.2);
|
||||
}
|
||||
|
||||
.hub-tag--both {
|
||||
color: var(--accent-2);
|
||||
background: rgba(255, 230, 109, 0.12);
|
||||
border-color: rgba(255, 230, 109, 0.2);
|
||||
}
|
||||
|
||||
.hub-tag--warn {
|
||||
color: var(--accent-1);
|
||||
background: rgba(255, 107, 107, 0.12);
|
||||
border-color: rgba(255, 107, 107, 0.25);
|
||||
}
|
||||
|
||||
.hub-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* ── Float pill (nomadro hub-float-card) ── */
|
||||
.hub-float-card {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
padding: 10px 14px;
|
||||
background: var(--bg-card);
|
||||
border: var(--border-glass);
|
||||
border-radius: var(--radius-md);
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.8rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
backdrop-filter: blur(20px);
|
||||
box-shadow: var(--shadow-card);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* ── Buttons ── */
|
||||
.hub-icon-btn {
|
||||
width: 38px;
|
||||
height: 38px;
|
||||
border-radius: 12px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
color: var(--text-muted);
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(12px);
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.hub-icon-btn.is-on,
|
||||
.hub-icon-btn:active {
|
||||
color: var(--accent-3);
|
||||
border-color: rgba(78, 205, 196, 0.35);
|
||||
background: rgba(78, 205, 196, 0.1);
|
||||
}
|
||||
|
||||
.hub-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 10px 16px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
font-family: var(--font-display);
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.hub-btn--primary {
|
||||
color: #0a0e17;
|
||||
background: var(--gradient-main);
|
||||
box-shadow: 0 4px 16px rgba(255, 107, 107, 0.22);
|
||||
}
|
||||
|
||||
.hub-btn--ghost {
|
||||
color: var(--text-primary);
|
||||
background: var(--bg-glass);
|
||||
border: var(--border-glass);
|
||||
}
|
||||
|
||||
.hub-btn--teal {
|
||||
color: var(--accent-3);
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
border: 1px solid rgba(78, 205, 196, 0.25);
|
||||
}
|
||||
|
||||
/* ── Inputs ── */
|
||||
.hub-input,
|
||||
.hub-field input,
|
||||
.hub-field select,
|
||||
.hub-field textarea {
|
||||
width: 100%;
|
||||
padding: 10px 12px;
|
||||
border-radius: 12px;
|
||||
border: var(--border-glass);
|
||||
background: rgba(10, 14, 23, 0.55);
|
||||
color: var(--text-primary);
|
||||
font-size: 14px;
|
||||
font-family: inherit;
|
||||
outline: none;
|
||||
transition: border-color var(--transition);
|
||||
}
|
||||
|
||||
.hub-field input:focus,
|
||||
.hub-field select:focus,
|
||||
.hub-field textarea:focus {
|
||||
border-color: rgba(78, 205, 196, 0.4);
|
||||
}
|
||||
|
||||
.hub-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.hub-field label {
|
||||
font-size: 11px;
|
||||
color: var(--text-muted);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ── Section ── */
|
||||
.hub-section-title {
|
||||
font-family: var(--font-display);
|
||||
font-size: 0.9rem;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
color: var(--accent-3);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.hub-empty {
|
||||
padding: 32px 16px;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ── Filter bar ── */
|
||||
.filter-bar {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 5px;
|
||||
border-radius: 999px;
|
||||
background: rgba(10, 14, 23, 0.55);
|
||||
border: var(--border-glass);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.filter-chip {
|
||||
padding: 7px 14px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: var(--text-secondary);
|
||||
transition: all var(--transition);
|
||||
}
|
||||
|
||||
.filter-chip.is-active {
|
||||
color: #0a0e17;
|
||||
background: var(--gradient-main);
|
||||
box-shadow: 0 4px 16px rgba(255, 107, 107, 0.22);
|
||||
}
|
||||
|
||||
.filter-bar--secondary .filter-chip--ghost {
|
||||
color: var(--text-muted);
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.filter-bar--secondary .filter-chip--ghost.is-active {
|
||||
color: var(--accent-3);
|
||||
background: rgba(78, 205, 196, 0.12);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/* ── App shell ── */
|
||||
.app-shell {
|
||||
position: relative;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--bg-primary);
|
||||
}
|
||||
|
||||
.app-main {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.page {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.page-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 4px 16px 20px;
|
||||
}
|
||||
|
||||
.scroll-y {
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
106
src/types/contact.ts
Normal file
@ -0,0 +1,106 @@
|
||||
export type ContactPurpose = 'business' | 'dating' | 'both'
|
||||
|
||||
export type RelationshipStage =
|
||||
| 'met'
|
||||
| 'chatting'
|
||||
| 'interacting'
|
||||
| 'meeting'
|
||||
| 'second_meeting'
|
||||
| 'stable'
|
||||
|
||||
export type ContactSource =
|
||||
| 'douyin'
|
||||
| 'xiaohongshu'
|
||||
| 'wechat'
|
||||
| 'youtube'
|
||||
| 'offline'
|
||||
| 'event'
|
||||
| 'referral'
|
||||
| 'coffee'
|
||||
| 'campus'
|
||||
| 'travel'
|
||||
| 'other'
|
||||
|
||||
export interface GeoLocation {
|
||||
country: string
|
||||
countryCode: string
|
||||
city: string
|
||||
lat: number
|
||||
lng: number
|
||||
}
|
||||
|
||||
export interface Contact {
|
||||
id: string
|
||||
name: string
|
||||
nameEn?: string
|
||||
gender: 'female' | 'male' | 'other'
|
||||
age: number
|
||||
occupation: string
|
||||
relationshipStatus: 'single' | 'married' | 'unknown'
|
||||
purpose: ContactPurpose
|
||||
photos: string[]
|
||||
avatarColor: string
|
||||
bio: string
|
||||
location: GeoLocation
|
||||
phone?: string
|
||||
wechat?: string
|
||||
telegram?: string
|
||||
tags: string[]
|
||||
source: ContactSource
|
||||
stage: RelationshipStage
|
||||
starred: boolean
|
||||
blacklisted: boolean
|
||||
lastInteractionDays: number
|
||||
notes: string
|
||||
chatLog: string[]
|
||||
}
|
||||
|
||||
export interface CountryCluster {
|
||||
country: string
|
||||
countryCode: string
|
||||
lat: number
|
||||
lng: number
|
||||
contacts: Contact[]
|
||||
}
|
||||
|
||||
export interface CityCluster {
|
||||
city: string
|
||||
lat: number
|
||||
lng: number
|
||||
contacts: Contact[]
|
||||
}
|
||||
|
||||
export const STAGE_LABELS: Record<RelationshipStage, string> = {
|
||||
met: '认识',
|
||||
chatting: '聊天',
|
||||
interacting: '互动',
|
||||
meeting: '见面',
|
||||
second_meeting: '二次见面',
|
||||
stable: '稳定关系',
|
||||
}
|
||||
|
||||
export const STAGE_ORDER: RelationshipStage[] = [
|
||||
'met',
|
||||
'chatting',
|
||||
'interacting',
|
||||
'meeting',
|
||||
'second_meeting',
|
||||
'stable',
|
||||
]
|
||||
|
||||
export const SOURCE_LABELS: Record<ContactSource, string> = {
|
||||
douyin: '抖音',
|
||||
xiaohongshu: '小红书',
|
||||
wechat: '公众号',
|
||||
youtube: 'YouTube',
|
||||
offline: '线下',
|
||||
event: '活动',
|
||||
referral: '朋友介绍',
|
||||
coffee: '咖啡店',
|
||||
campus: '大学城',
|
||||
travel: '旅行',
|
||||
other: '其他',
|
||||
}
|
||||
|
||||
export const GENDER_LABELS = { female: '女', male: '男', other: '其他' } as const
|
||||
export const STATUS_LABELS = { single: '单身', married: '已婚', unknown: '未知' } as const
|
||||
43
src/types/filters.ts
Normal file
@ -0,0 +1,43 @@
|
||||
import type { ContactPurpose, ContactSource, RelationshipStage } from './contact'
|
||||
|
||||
export type PurposeFilter = ContactPurpose | 'all'
|
||||
export type GenderFilter = 'all' | 'female' | 'male'
|
||||
export type AgeFilter = 'all' | 'under25' | '25to30' | 'over30'
|
||||
export type StatusFilter = 'all' | 'single' | 'married'
|
||||
export type PeopleListFilter = 'all' | 'starred' | 'followup'
|
||||
export type RosterViewFilter = 'all' | 'coffee' | 'resume'
|
||||
|
||||
export interface ContactFilters {
|
||||
purpose: PurposeFilter
|
||||
gender: GenderFilter
|
||||
age: AgeFilter
|
||||
status: StatusFilter
|
||||
source: ContactSource | 'all'
|
||||
stage: RelationshipStage | 'all'
|
||||
occupation: string
|
||||
search: string
|
||||
}
|
||||
|
||||
export const DEFAULT_FILTERS: ContactFilters = {
|
||||
purpose: 'all',
|
||||
gender: 'all',
|
||||
age: 'all',
|
||||
status: 'all',
|
||||
source: 'all',
|
||||
stage: 'all',
|
||||
occupation: 'all',
|
||||
search: '',
|
||||
}
|
||||
|
||||
export function countActiveFilters(f: ContactFilters) {
|
||||
let n = 0
|
||||
if (f.purpose !== 'all') n++
|
||||
if (f.gender !== 'all') n++
|
||||
if (f.age !== 'all') n++
|
||||
if (f.status !== 'all') n++
|
||||
if (f.source !== 'all') n++
|
||||
if (f.stage !== 'all') n++
|
||||
if (f.occupation !== 'all') n++
|
||||
if (f.search.trim()) n++
|
||||
return n
|
||||
}
|
||||
35
src/utils/applyFilters.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import type { Contact } from '../types/contact'
|
||||
import type { ContactFilters, PeopleListFilter } from '../types/filters'
|
||||
|
||||
export function applyContactFilters(contacts: Contact[], filters: ContactFilters): Contact[] {
|
||||
const q = filters.search.trim().toLowerCase()
|
||||
|
||||
return contacts.filter((c) => {
|
||||
if (c.blacklisted) return false
|
||||
|
||||
if (filters.purpose !== 'all') {
|
||||
if (c.purpose !== filters.purpose && c.purpose !== 'both') return false
|
||||
}
|
||||
if (filters.gender !== 'all' && c.gender !== filters.gender) return false
|
||||
if (filters.age === 'under25' && c.age >= 25) return false
|
||||
if (filters.age === '25to30' && (c.age < 25 || c.age > 30)) return false
|
||||
if (filters.age === 'over30' && c.age <= 30) return false
|
||||
if (filters.status !== 'all' && c.relationshipStatus !== filters.status) return false
|
||||
if (filters.source !== 'all' && c.source !== filters.source) return false
|
||||
if (filters.stage !== 'all' && c.stage !== filters.stage) return false
|
||||
if (filters.occupation !== 'all' && c.occupation !== filters.occupation) return false
|
||||
|
||||
if (q) {
|
||||
const hay = `${c.name} ${c.nameEn ?? ''} ${c.occupation} ${c.location.city} ${c.location.country} ${c.wechat ?? ''} ${c.telegram ?? ''}`.toLowerCase()
|
||||
if (!hay.includes(q)) return false
|
||||
}
|
||||
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
export function applyPeopleListFilter(contacts: Contact[], listFilter: PeopleListFilter): Contact[] {
|
||||
if (listFilter === 'starred') return contacts.filter((c) => c.starred)
|
||||
if (listFilter === 'followup') return contacts.filter((c) => c.lastInteractionDays >= 5)
|
||||
return contacts
|
||||
}
|
||||
26
tsconfig.app.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||
"target": "es2023",
|
||||
"lib": ["ES2023", "DOM"],
|
||||
"module": "esnext",
|
||||
"types": ["vite/client"],
|
||||
"allowArbitraryExtensions": true,
|
||||
"skipLibCheck": true,
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"moduleDetection": "force",
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
|
||||
/* Linting */
|
||||
"noUnusedLocals": true,
|
||||
"noUnusedParameters": true,
|
||||
"erasableSyntaxOnly": true,
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
7
tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [],
|
||||
"references": [
|
||||
{ "path": "./tsconfig.app.json" },
|
||||
{ "path": "./tsconfig.node.json" }
|
||||
]
|
||||
}
|
||||