Release v1.0.2: Fix startup syntax error, offline mode, UI improvements

This commit is contained in:
Gemini AI
2025-12-06 23:41:51 +04:00
Unverified
parent 864070b26a
commit 5e9ffe1997
66 changed files with 2596 additions and 216 deletions

View File

@@ -0,0 +1,30 @@
# 📱 How to Build the Offline APK
I have converted the application to **Offline Mode**. It now stores all data locally on the device, so you **DO NOT** need to deploy a backend server.
## 🚀 Steps to Build APK
1. **Copy the Project:**
Download the entire `MindShift-Windows` folder to your local machine.
2. **Install Dependencies:**
Open a terminal in the `MindShift-Windows` folder and run:
```bash
npm install
```
3. **Open Android Studio:**
Run the following command to open the project in Android Studio (you must have Android Studio installed):
```bash
npx cap open android
```
4. **Build & Run:**
- In Android Studio, wait for Gradle to sync.
- Click the **Run** (Play) button to test on an emulator/device.
- To build the APK: Go to `Build > Build Bundle(s) / APK(s) > Build APK(s)`.
## Notes
- The app now uses `localStorage` to save your Moods, Thoughts, and Gratitude entries.
- If you uninstall the app, your data will be cleared (standard behavior for local-only apps).
- No internet connection is required for the app to function.

View File

@@ -0,0 +1,55 @@
@echo off
echo ===================================================
echo MindShift APK Builder (One-Click)
echo ===================================================
echo.
:: Check for Java
where java >nul 2>nul
if %errorlevel% neq 0 (
echo [ERROR] Java is not installed or not in PATH.
echo Please install Java (JDK 17 recommended) and try again.
pause
exit /b
)
:: Check for Android Home
if "%ANDROID_HOME%"=="" (
echo [ERROR] ANDROID_HOME environment variable is not set.
echo Please install Android Studio and set ANDROID_HOME to your SDK location.
pause
exit /b
)
echo [1/3] Installing dependencies...
call npm install
if %errorlevel% neq 0 (
echo Failed to install dependencies.
pause
exit /b
)
echo [2/3] Syncing Capacitor...
call npx cap sync
if %errorlevel% neq 0 (
echo Failed to sync Capacitor.
pause
exit /b
)
echo [3/3] Building APK (Debug Mode)...
cd android
call gradlew.bat assembleDebug
cd ..
echo.
echo ===================================================
if exist "android\app\build\outputs\apk\debug\app-debug.apk" (
echo [SUCCESS] APK created successfully!
echo Location: android\app\build\outputs\apk\debug\app-debug.apk
explorer "android\app\build\outputs\apk\debug\"
) else (
echo [ERROR] Build failed. Please check the logs above.
)
echo ===================================================
pause

Binary file not shown.

Binary file not shown.

Binary file not shown.

101
MindShift-Windows/android/.gitignore vendored Normal file
View 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

View File

@@ -0,0 +1,2 @@
/build/*
!/build/.npmkeep

View File

@@ -0,0 +1,54 @@
apply plugin: 'com.android.application'
android {
namespace "com.mindshift.app"
compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.mindshift.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")
}

View 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-haptics')
}
if (hasProperty('postBuildExtras')) {
postBuildExtras()
}

View 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

View File

@@ -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());
}
}

View File

@@ -0,0 +1,41 @@
<?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:theme="@style/AppTheme">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode|navigation"
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
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>

View File

@@ -0,0 +1,5 @@
package com.mindshift.app;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -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>

View 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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

View 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>

View File

@@ -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>

View File

@@ -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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<resources>
<string name="app_name">MindShift</string>
<string name="title_activity_main">MindShift</string>
<string name="package_name">com.mindshift.app</string>
<string name="custom_url_scheme">com.mindshift.app</string>
</resources>

View 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>

View 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>

View File

@@ -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);
}
}

View 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.7.2'
classpath 'com.google.gms:google-services:4.4.2'
// 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
}

View 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-haptics'
project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/haptics/android')

View 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

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

252
MindShift-Windows/android/gradlew vendored Normal file
View File

@@ -0,0 +1,252 @@
#!/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
' "$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=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# 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, 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" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# 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
MindShift-Windows/android/gradlew.bat vendored Normal file
View 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=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
: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

View 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'

View File

@@ -0,0 +1,16 @@
ext {
minSdkVersion = 23
compileSdkVersion = 35
targetSdkVersion = 35
androidxActivityVersion = '1.9.2'
androidxAppCompatVersion = '1.7.0'
androidxCoordinatorLayoutVersion = '1.2.0'
androidxCoreVersion = '1.15.0'
androidxFragmentVersion = '1.8.4'
coreSplashScreenVersion = '1.0.1'
androidxWebkitVersion = '1.12.1'
junitVersion = '4.13.2'
androidxJunitVersion = '1.2.1'
androidxEspressoCoreVersion = '3.6.1'
cordovaAndroidVersion = '10.1.1'
}

View File

@@ -0,0 +1,62 @@
#!/bin/bash
set -e
echo "🚀 Starting Automated APK Build in WSL..."
# --- SETUP JAVA 21 (Portable) ---
JAVA_DIR="$HOME/java-21"
if [ ! -d "$JAVA_DIR" ]; then
echo "⬇️ Downloading OpenJDK 21 (Temurin)..."
mkdir -p "$JAVA_DIR"
cd "$JAVA_DIR"
# Adoptium Temurin JDK 21
wget -q -L https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.2%2B13/OpenJDK21U-jdk_x64_linux_hotspot_21.0.2_13.tar.gz -O jdk21.tar.gz
tar -xzf jdk21.tar.gz --strip-components=1
rm jdk21.tar.gz
echo "✅ Java 21 Installed."
else
echo "✅ Java 21 already present."
fi
export JAVA_HOME="$JAVA_DIR"
export PATH="$JAVA_HOME/bin:$PATH"
# --- SETUP ANDROID SDK ---
SDK_DIR="$HOME/android-sdk"
mkdir -p "$SDK_DIR/cmdline-tools"
if [ ! -d "$SDK_DIR/cmdline-tools/latest" ]; then
echo "⬇️ Downloading Android Command Line Tools..."
cd "$SDK_DIR/cmdline-tools"
wget -q https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip -O tools.zip
unzip -q tools.zip
mv cmdline-tools latest
rm tools.zip
echo "✅ Tools downloaded."
else
echo "✅ Android Tools already present."
fi
export ANDROID_HOME="$SDK_DIR"
export PATH="$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools"
# --- INSTALL SDK PACKAGES ---
echo "📦 Checking SDK Packages..."
yes | sdkmanager --licenses > /dev/null
# Only install if missing to save time
if [ ! -d "$SDK_DIR/platforms/android-35" ]; then
echo "⬇️ Installing Platform 35..."
sdkmanager "platform-tools" "platforms;android-35" "build-tools;35.0.0" > /dev/null
fi
# --- BUILD APK ---
PROJECT_DIR="/mnt/e/TRAE Playground/MindShift-Windows/android"
cd "$PROJECT_DIR"
echo "🔨 Building APK with Java 21..."
chmod +x gradlew
./gradlew assembleDebug
# --- SUCCESS ---
echo "🎉 Build Complete!"
echo "APK Location: $PROJECT_DIR/app/build/outputs/apk/debug/app-debug.apk"

View File

@@ -0,0 +1,9 @@
import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.mindshift.app',
appName: 'MindShift',
webDir: 'src'
};
export default config;

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{ {
"name": "mindshift-cbt-therapy", "name": "mindshift-cbt-therapy",
"version": "1.0.0", "version": "1.0.2",
"description": "MindShift - Your personal CBT therapy companion for Windows 11", "description": "MindShift - Your personal CBT therapy companion for Windows 11",
"main": "src/main.js", "main": "src/main.js",
"homepage": "./", "homepage": "./",
@@ -61,6 +61,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@capacitor/android": "^7.4.4",
"@capacitor/cli": "^7.4.4",
"@capacitor/core": "^7.4.4",
"@capacitor/haptics": "^7.0.2",
"electron-updater": "^6.1.7" "electron-updater": "^6.1.7"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -1,4 +1,4 @@
import { authAPI, moodAPI, thoughtAPI, gratitudeAPI, progressAPI, notificationAPI, exerciseAPI, isAuthenticated, initializeAPI } from './api.js'; import { authAPI, moodAPI, thoughtAPI, gratitudeAPI, progressAPI, notificationAPI, exerciseAPI, isAuthenticated, initializeAPI } from './offline-api.js';
// Sound Manager using Web Audio API // Sound Manager using Web Audio API
class SoundManager { class SoundManager {
@@ -69,9 +69,16 @@ const soundManager = new SoundManager();
// Initialize app when DOM is loaded // Initialize app when DOM is loaded
document.addEventListener('DOMContentLoaded', async function() { document.addEventListener('DOMContentLoaded', async function() {
try {
console.log('App initialization started');
// Check authentication // Check authentication
if (!isAuthenticated()) { if (!isAuthenticated()) {
console.log('User not authenticated, showing login modal');
showLoginModal(); showLoginModal();
// Hide initial loader if login modal is shown
const loader = document.getElementById('initial-loader');
if (loader) loader.style.display = 'none';
return; return;
} }
@@ -104,6 +111,15 @@ document.addEventListener('DOMContentLoaded', async function() {
// Initialize inactivity tracker // Initialize inactivity tracker
initInactivityTracker(); initInactivityTracker();
console.log('App initialization complete');
} catch (error) {
console.error('Initialization error:', error);
const loader = document.getElementById('initial-loader');
if (loader) {
loader.innerHTML = `<div style="color: red; padding: 20px;"><h3>Init Error</h3><p>${error.message}</p></div>`;
}
}
}); });
// Inactivity Tracker // Inactivity Tracker
@@ -287,7 +303,8 @@ async function saveMoodEntry() {
intensity = slider ? slider.value : '5'; intensity = slider ? slider.value : '5';
} }
const notes = document.getElementById('moodNotes')?.value; const notesInput = document.getElementById('moodNotes');
const notes = notesInput ? notesInput.value : '';
if (!moodType) { if (!moodType) {
showToast('Please select a mood', 'warning'); showToast('Please select a mood', 'warning');
@@ -325,10 +342,10 @@ async function saveMoodEntry() {
// Thought record with API // Thought record with API
async function saveThoughtRecord() { async function saveThoughtRecord() {
const situation = document.getElementById('situation')?.value; const situation = document.getElementById('situation') ? document.getElementById('situation').value : '';
const thoughts = document.getElementById('thoughts')?.value; const thoughts = document.getElementById('thoughts') ? document.getElementById('thoughts').value : '';
const evidence = document.getElementById('evidence')?.value; const evidence = document.getElementById('evidence') ? document.getElementById('evidence').value : '';
const alternative = document.getElementById('alternative')?.value; const alternative = document.getElementById('alternative') ? document.getElementById('alternative').value : '';
if (!situation || !thoughts) { if (!situation || !thoughts) {
showToast('Please fill in at least the situation and thoughts', 'warning'); showToast('Please fill in at least the situation and thoughts', 'warning');
@@ -338,8 +355,10 @@ async function saveThoughtRecord() {
// Get emotions // Get emotions
const emotions = []; const emotions = [];
document.querySelectorAll('.emotion-inputs').forEach(input => { document.querySelectorAll('.emotion-inputs').forEach(input => {
const name = input.querySelector('.emotion-name')?.value; const nameInput = input.querySelector('.emotion-name');
const value = input.querySelector('.emotion-slider')?.value; const valueInput = input.querySelector('.emotion-slider');
const name = nameInput ? nameInput.value : '';
const value = valueInput ? valueInput.value : '';
if (name && value) { if (name && value) {
emotions.push({ name, intensity: parseInt(value) }); emotions.push({ name, intensity: parseInt(value) });
} }
@@ -412,37 +431,75 @@ async function loadSavedData() {
// Progress with API // Progress with API
async function updateProgress() { async function updateProgress() {
console.log('updateProgress: Starting update...');
try { try {
const stats = await progressAPI.getProgressStats(); // Add timeout to prevent infinite loading
const history = await progressAPI.getProgressHistory(); const timeoutPromise = new Promise((_, reject) =>
setTimeout(() => reject(new Error('Timeout loading stats')), 5000)
);
// Update progress stats const statsPromise = progressAPI.getProgressStats();
const progressContainer = document.getElementById('progress-stats'); const historyPromise = progressAPI.getProgressHistory();
if (progressContainer) {
progressContainer.innerHTML = ` const [stats, history] = await Promise.race([
Promise.all([statsPromise, historyPromise]),
timeoutPromise
]);
console.log('updateProgress: Data received', stats);
const statsHTML = `
<div class="progress-card"> <div class="progress-card">
<div class="progress-value">${stats.today.mood_score || '-'}</div> <div class="progress-value">${(stats.today && stats.today.mood_score) ? stats.today.mood_score : '-'}</div>
<div class="progress-label">Today's Mood</div> <div class="progress-label">Today's Mood</div>
</div> </div>
<div class="progress-card"> <div class="progress-card">
<div class="progress-value">${stats.totals.totalSessions || 0}</div> <div class="progress-value">${(stats.totals && stats.totals.totalSessions) ? stats.totals.totalSessions : 0}</div>
<div class="progress-label">Sessions</div> <div class="progress-label">Sessions</div>
</div> </div>
<div class="progress-card"> <div class="progress-card">
<div class="progress-value">${Math.round(stats.week.avgMood * 10) / 10 || '-'}</div> <div class="progress-value">${(stats.week && stats.week.avgMood) ? (Math.round(stats.week.avgMood * 10) / 10) : '-'}</div>
<div class="progress-label">Weekly Avg</div> <div class="progress-label">Weekly Avg</div>
</div> </div>
<div class="progress-card"> <div class="progress-card">
<div class="progress-value">${stats.totals.totalGratitude || 0}</div> <div class="progress-value">${(stats.totals && stats.totals.totalGratitude) ? stats.totals.totalGratitude : 0}</div>
<div class="progress-label">Gratitude</div> <div class="progress-label">Gratitude</div>
</div> </div>
`; `;
// Update progress page stats
const progressContainer = document.getElementById('progress-stats');
if (progressContainer) {
progressContainer.innerHTML = statsHTML;
}
// Update home page stats
const homeStatsContainer = document.getElementById('home-stats-container');
if (homeStatsContainer) {
homeStatsContainer.innerHTML = `<div class="progress-container">${statsHTML}</div>`;
} }
// Draw weekly chart // Draw weekly chart
drawWeeklyChart(history); drawWeeklyChart(history);
console.log('updateProgress: Update complete');
} catch (error) { } catch (error) {
console.error('Failed to update progress:', error); console.error('Failed to update progress:', error);
// Fallback UI to remove spinner
const errorHTML = `
<div class="progress-container">
<div class="progress-card" onclick="updateProgress()">
<div class="progress-value">⚠️</div>
<div class="progress-label">Tap to Retry</div>
</div>
</div>
`;
const homeStatsContainer = document.getElementById('home-stats-container');
if (homeStatsContainer) {
homeStatsContainer.innerHTML = errorHTML;
}
} }
} }
@@ -793,6 +850,7 @@ async function renderHistory(type) {
const container = document.getElementById('history-container'); const container = document.getElementById('history-container');
if (!container) return; if (!container) return;
// Clear existing content
container.innerHTML = '<div class="spinner"></div>'; container.innerHTML = '<div class="spinner"></div>';
try { try {
@@ -1190,24 +1248,6 @@ function startGratitude() {
document.getElementById('exercises').classList.add('blur-background'); document.getElementById('exercises').classList.add('blur-background');
} }
function startBreathing() {
const modal = document.createElement('div');
modal.className = 'exercise-modal';
modal.style.display = 'block';
modal.innerHTML = `
<div class="card breathing-content">
<h2 class="card-title">Breathe With Me 🌬️</h2>
<div id="breathing-circle" class="breathing-circle inhale">
<span id="breathing-text" class="breathing-text">Breathe In</span>
</div>
<p class="breathing-instructions">Follow the rhythm of the circle and the sound cues.</p>
<button class="btn btn-secondary" onclick="stopBreathingExercise(); this.closest('.exercise-modal').remove()">Finish</button>
</div>
`;
document.body.appendChild(modal);
startBreathingExercise();
}
function closeExercise(exerciseId) { function closeExercise(exerciseId) {
document.getElementById(exerciseId).style.display = 'none'; document.getElementById(exerciseId).style.display = 'none';
document.getElementById('exercises').classList.remove('blur-background'); document.getElementById('exercises').classList.remove('blur-background');
@@ -1236,53 +1276,177 @@ function addGratitudeInput() {
gratitudeContainer.appendChild(newInput); gratitudeContainer.appendChild(newInput);
} }
// Breathing exercise functions // --- Smart Breathing System ---
let breathingInterval; let breathingState = {
let breathingPhase = 'inhale'; isActive: false,
technique: 'balance',
timer: null
};
function startBreathingExercise() { const breathingTechniques = {
// Initial sound balance: {
name: 'Balance',
label: 'Coherent Breathing',
phases: [
{ name: 'inhale', duration: 5500, label: 'Breathe In', scale: 1.8 },
{ name: 'exhale', duration: 5500, label: 'Breathe Out', scale: 1.0 }
]
},
relax: {
name: 'Relax',
label: '4-7-8 Relief',
phases: [
{ name: 'inhale', duration: 4000, label: 'Breathe In', scale: 1.8 },
{ name: 'hold', duration: 7000, label: 'Hold', scale: 1.8 },
{ name: 'exhale', duration: 8000, label: 'Breathe Out', scale: 1.0 }
]
},
focus: {
name: 'Focus',
label: 'Box Breathing',
phases: [
{ name: 'inhale', duration: 4000, label: 'Breathe In', scale: 1.8 },
{ name: 'hold', duration: 4000, label: 'Hold', scale: 1.8 },
{ name: 'exhale', duration: 4000, label: 'Breathe Out', scale: 1.0 },
{ name: 'hold', duration: 4000, label: 'Hold', scale: 1.0 }
]
}
};
function startBreathing() {
// Create immersive overlay
const overlay = document.createElement('div');
overlay.id = 'smart-breathing-overlay';
overlay.className = 'breathing-overlay';
overlay.innerHTML = `
<div class="technique-selector">
<button class="technique-btn" onclick="setBreathingTechnique('balance')">Balance</button>
<button class="technique-btn" onclick="setBreathingTechnique('relax')">Relax</button>
<button class="technique-btn" onclick="setBreathingTechnique('focus')">Focus</button>
</div>
<div class="breathing-visual-container">
<div class="breath-particles"></div>
<div id="breath-circle" class="breath-circle-main"></div>
<div class="breath-circle-inner"></div>
</div>
<div id="breath-instruction" class="breath-instruction-text">Get Ready...</div>
<div id="breath-sub" class="breath-sub-text">Sit comfortably</div>
<div class="breath-controls">
<button class="control-btn-icon" onclick="closeSmartBreathing()">
<span class="material-icons">close</span>
</button>
</div>
`;
document.body.appendChild(overlay);
// Start with default or last used
setBreathingTechnique('balance');
}
function setBreathingTechnique(tech) {
breathingState.technique = tech;
// Update buttons
document.querySelectorAll('.technique-btn').forEach(btn => {
btn.classList.remove('active');
if(btn.innerText.toLowerCase().includes(breathingTechniques[tech].name.toLowerCase())) {
btn.classList.add('active');
}
});
stopSmartBreathingLoop();
startSmartBreathingLoop();
}
function startSmartBreathingLoop() {
breathingState.isActive = true;
let currentPhaseIndex = 0;
const loop = async () => {
if (!breathingState.isActive) return;
const technique = breathingTechniques[breathingState.technique];
const phase = technique.phases[currentPhaseIndex];
updateBreathingUI(phase.name, phase.label, phase.duration, phase.scale);
// Audio & Haptics
if (phase.name === 'inhale') {
soundManager.playBreathIn(); soundManager.playBreathIn();
if (navigator.vibrate) navigator.vibrate(50);
breathingInterval = setInterval(() => { } else if (phase.name === 'exhale') {
const circle = document.getElementById('breathing-circle');
const text = document.getElementById('breathing-text');
if (breathingPhase === 'inhale') {
circle.classList.remove('exhale');
circle.classList.add('inhale');
text.textContent = 'Breathe In';
soundManager.playBreathIn();
breathingPhase = 'hold';
} else if (breathingPhase === 'hold') {
text.textContent = 'Hold';
breathingPhase = 'exhale';
} else {
circle.classList.remove('inhale');
circle.classList.add('exhale');
text.textContent = 'Breathe Out';
soundManager.playBreathOut(); soundManager.playBreathOut();
breathingPhase = 'inhale'; if (navigator.vibrate) navigator.vibrate([30, 30]);
} } else {
}, 4000); // Hold
if (navigator.vibrate) navigator.vibrate(20);
} }
function stopBreathingExercise() { // Wait for phase duration
clearInterval(breathingInterval); await new Promise(resolve => {
const circle = document.getElementById('breathing-circle'); breathingState.timer = setTimeout(resolve, phase.duration);
const text = document.getElementById('breathing-text'); });
if (circle) circle.classList.remove('inhale', 'exhale');
if (text) text.textContent = 'Ready';
breathingPhase = 'inhale';
// Log session (assuming ~1 min or track actual time) // Move to next phase
currentPhaseIndex = (currentPhaseIndex + 1) % technique.phases.length;
if (breathingState.isActive) loop();
};
loop();
}
function updateBreathingUI(phaseName, label, duration, scale) {
const circle = document.getElementById('breath-circle');
const text = document.getElementById('breath-instruction');
const sub = document.getElementById('breath-sub');
if (!circle) return;
// Update Text
text.textContent = label;
text.style.animation = 'none';
text.offsetHeight; // Trigger reflow
text.style.animation = 'fadeIn 0.5s';
sub.textContent = (duration / 1000) + 's';
// Update Visuals
circle.className = 'breath-circle-main ' + phaseName;
circle.style.transition = `transform ${duration}ms linear`;
circle.style.transform = `scale(${scale})`;
}
function stopSmartBreathingLoop() {
breathingState.isActive = false;
if (breathingState.timer) clearTimeout(breathingState.timer);
}
function closeSmartBreathing() {
stopSmartBreathingLoop();
const overlay = document.getElementById('smart-breathing-overlay');
if (overlay) overlay.remove();
// Log session
exerciseAPI.logSession('breathing', 60).then(() => { exerciseAPI.logSession('breathing', 60).then(() => {
triggerSuccessPing(); triggerSuccessPing();
showSuccessMessage('Breathing session logged! 🌬️'); showSuccessMessage('Breathing session complete! 🌬️');
updateProgress(); updateProgress();
}); });
} }
// Make global
window.setBreathingTechnique = setBreathingTechnique;
window.closeSmartBreathing = closeSmartBreathing;
// Legacy wrappers
function startBreathingExercise() { startBreathing(); }
function stopBreathingExercise() { closeSmartBreathing(); }
// Export additional functions // Export additional functions
window.addEmotionInput = addEmotionInput; window.addEmotionInput = addEmotionInput;
window.addGratitudeInput = addGratitudeInput; window.addGratitudeInput = addGratitudeInput;

View File

@@ -2,11 +2,11 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>MindShift - CBT Therapy App</title> <title>MindShift - CBT Therapy App</title>
<!-- PWA Meta Tags --> <!-- PWA Meta Tags -->
<meta name="theme-color" content="#FF6B6B"> <meta name="theme-color" content="#8ECAE6">
<meta name="description" content="Your personal CBT therapy companion for mood management and mental wellness"> <meta name="description" content="Your personal CBT therapy companion for mood management and mental wellness">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default"> <meta name="apple-mobile-web-app-status-bar-style" content="default">
@@ -72,7 +72,11 @@
<!-- Main Content --> <!-- Main Content -->
<main id="main-content" class="main-content"> <main id="main-content" class="main-content">
<!-- Content will be dynamically loaded here --> <!-- Loading State -->
<div id="initial-loader" style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 80vh; color: #666;">
<div class="spinner" style="width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid #FF6B6B; border-radius: 50%; animation: spin 1s linear infinite;"></div>
<p style="margin-top: 20px; font-family: sans-serif;">Initializing MindShift...</p>
</div>
</main> </main>
<!-- Bottom Navigation --> <!-- Bottom Navigation -->
@@ -104,8 +108,19 @@
<span class="material-icons">add</span> <span class="material-icons">add</span>
</button> </button>
<style>
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
</style>
<!-- Scripts --> <!-- Scripts -->
<script type="module" src="api.js"></script> <script>
<script type="module" src="app.js"></script> window.addEventListener('error', function(e) {
// Display error on screen if app fails to load
var loader = document.getElementById('initial-loader');
if (loader) {
loader.innerHTML = '<div style="color: red; padding: 20px; text-align: center;"><h3>Error Loading App</h3><p>' + e.message + '</p></div>';
}
});
</script>
<script type="module" src="./app.js"></script>
</body> </body>
</html> </html>

View File

@@ -0,0 +1,228 @@
// Offline API Implementation using LocalStorage
// This replaces the server-based API for the offline APK build
// --- Local Database Helper ---
const db = {
get(key) {
const data = localStorage.getItem(`mindshift_${key}`);
return data ? JSON.parse(data) : [];
},
set(key, data) {
localStorage.setItem(`mindshift_${key}`, JSON.stringify(data));
},
add(key, item) {
const data = this.get(key);
item.id = Date.now().toString();
item.created_at = new Date().toISOString();
// Add user_id if logged in
const user = getCurrentUser();
if (user) item.user_id = user.id;
data.push(item);
this.set(key, data);
return item;
},
update(key, id, updates) {
const data = this.get(key);
const index = data.findIndex(item => item.id === id);
if (index !== -1) {
data[index] = { ...data[index], ...updates };
this.set(key, data);
return data[index];
}
return null;
},
remove(key, id) {
const data = this.get(key);
const newData = data.filter(item => item.id !== id);
this.set(key, newData);
}
};
function getCurrentUser() {
const userStr = localStorage.getItem('mindshift_currentUser');
return userStr ? JSON.parse(userStr) : null;
}
// --- Authentication API ---
export const authAPI = {
async register(name, email, password) {
// Simulate network delay
await new Promise(r => setTimeout(r, 500));
const users = db.get('users');
if (users.find(u => u.email === email)) {
throw new Error('Email already exists');
}
const newUser = { id: Date.now().toString(), name, email, password }; // In real app, hash password!
users.push(newUser);
db.set('users', users);
localStorage.setItem('mindshift_currentUser', JSON.stringify(newUser));
return { token: 'offline-token', user: newUser };
},
async login(email, password) {
await new Promise(r => setTimeout(r, 500));
const users = db.get('users');
const user = users.find(u => u.email === email && u.password === password);
if (!user) {
throw new Error('Invalid credentials');
}
localStorage.setItem('mindshift_currentUser', JSON.stringify(user));
return { token: 'offline-token', user };
},
async logout() {
localStorage.removeItem('mindshift_currentUser');
},
async getProfile() {
return getCurrentUser();
}
};
// --- Mood API ---
export const moodAPI = {
async trackMood(moodType, intensity, notes) {
return db.add('moods', { mood_type: moodType, intensity, notes });
},
async getMoodHistory() {
const user = getCurrentUser();
if (!user) return [];
const moods = db.get('moods').filter(m => m.user_id === user.id);
return moods.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
}
};
// --- Thought Record API ---
export const thoughtAPI = {
async saveThoughtRecord(thoughtData) {
// Map frontend keys to DB keys if needed, but for offline we can store as is
return db.add('thoughts', thoughtData);
},
async getThoughtRecords() {
const user = getCurrentUser();
if (!user) return [];
const thoughts = db.get('thoughts').filter(t => t.user_id === user.id);
return thoughts.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
},
async updateThoughtRecord(id, data) {
return db.update('thoughts', id, data);
},
async deleteThoughtRecord(id) {
return db.remove('thoughts', id);
}
};
// --- Gratitude API ---
export const gratitudeAPI = {
async saveGratitudeEntry(entry) {
// Entry object comes as { entries: [], date: ... }
// We'll store individual entries or the whole block.
// Let's store the block to match frontend expectation
return db.add('gratitude', entry);
},
async getGratitudeEntries() {
const user = getCurrentUser();
if (!user) return [];
const entries = db.get('gratitude').filter(g => g.user_id === user.id);
return entries.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
}
};
// --- Progress API ---
export const progressAPI = {
async getProgressStats() {
const user = getCurrentUser();
if (!user) return { today: {}, week: {}, totals: {} };
const moods = db.get('moods').filter(m => m.user_id === user.id);
const gratitude = db.get('gratitude').filter(g => g.user_id === user.id);
const exercises = db.get('exercises').filter(e => e.user_id === user.id);
const today = new Date().toISOString().split('T')[0];
const todayMoods = moods.filter(m => m.created_at.startsWith(today));
// Calculate stats
const todayAvg = todayMoods.length > 0
? todayMoods.reduce((sum, m) => sum + parseInt(m.intensity), 0) / todayMoods.length
: 0;
return {
today: { mood_score: todayAvg.toFixed(1) },
totals: {
totalSessions: exercises.length,
totalGratitude: gratitude.length
},
week: { avgMood: 0 } // simplified for offline
};
},
async getProgressHistory(days = 7) {
const user = getCurrentUser();
if (!user) return [];
const moods = db.get('moods').filter(m => m.user_id === user.id);
// Group by date and avg score
const history = [];
for (let i = 0; i < days; i++) {
const date = new Date();
date.setDate(date.getDate() - i);
const dateStr = date.toISOString().split('T')[0];
const dayMoods = moods.filter(m => m.created_at.startsWith(dateStr));
const score = dayMoods.length > 0
? dayMoods.reduce((sum, m) => sum + parseInt(m.intensity), 0) / dayMoods.length
: 0;
history.push({ date: dateStr, mood_score: score });
}
return history;
}
};
// --- Exercise API ---
export const exerciseAPI = {
async logSession(type, duration) {
return db.add('exercises', { exercise_type: type, duration });
}
};
// --- Notification API ---
export const notificationAPI = {
async getNotifications() {
const user = getCurrentUser();
if (!user) return [];
return db.get('notifications').filter(n => n.user_id === user.id);
},
async markAsRead(id) {
return db.update('notifications', id, { read: true });
},
async deleteNotification(id) {
return db.remove('notifications', id);
},
async addNotification(notification) {
return db.add('notifications', notification);
}
};
export function isAuthenticated() {
return !!getCurrentUser();
}
export function initializeAPI() {
return true;
}

View File

@@ -1,29 +1,36 @@
/* Base Styles & Variables */ /* Base Styles & Variables */
:root { :root {
--primary: #FF6B6B; /* Relaxing Palette */
--primary-light: #FF8E8E; --primary: #6B9080; /* Soft Sage Green */
--primary-dark: #E55555; --primary-light: #A4C3B2;
--primary-container: #FFE5E5; --primary-dark: #3A5A4A;
--primary-container: #EAF4F0;
--on-primary: #FFFFFF; --on-primary: #FFFFFF;
--on-primary-container: #410002; --on-primary-container: #1C3329;
--secondary: #FFB74D;
--secondary-container: #FFF3E0; --secondary: #8ECAE6; /* Soft Sky Blue */
--secondary-container: #E1F5FE;
--on-secondary: #FFFFFF; --on-secondary: #FFFFFF;
--on-secondary-container: #4E2B00; --on-secondary-container: #004D61;
--tertiary: #4FC3F7;
--tertiary-container: #E1F5FE; --tertiary: #B8B8FF; /* Gentle Lavender */
--surface: rgba(255, 255, 255, 0.9); --tertiary-container: #EFEEFF;
--surface-variant: #F5F5F5;
--on-surface: #212121; --surface: rgba(255, 255, 255, 0.92);
--on-surface-variant: #757575; --surface-variant: #F4F7F6; /* Very soft cool grey */
--outline: #BDBDBD; --on-surface: #2C3E50;
--shadow: rgba(0,0,0,0.1); --on-surface-variant: #607D8B;
--error: #FF5252;
--success: #66BB6A; --outline: #CFD8DC;
--warning: #FFA726; --shadow: rgba(44, 62, 80, 0.1);
--joy: #AB47BC;
--peace: #26A69A; --error: #E57373;
--energy: #FFEE58; --success: #81C784;
--warning: #FFB74D;
--joy: #9575CD;
--peace: #4DB6AC;
--energy: #FFF176;
} }
* { * {
@@ -34,9 +41,9 @@
body { body {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #FF6B6B 100%); background: linear-gradient(135deg, #FDFBF7 0%, #E6F3F0 100%); /* Relaxing Cream to Sage */
background-size: 400% 400%; background-size: 400% 400%;
animation: gradientBG 15s ease infinite; animation: gradientBG 20s ease infinite;
color: var(--on-surface); color: var(--on-surface);
line-height: 1.5; line-height: 1.5;
min-height: 100vh; min-height: 100vh;
@@ -113,7 +120,7 @@ body {
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background: linear-gradient(135deg, #FF6B6B 0%, #4ECDC4 100%); background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
@@ -159,10 +166,10 @@ body {
/* Header */ /* Header */
.app-header { .app-header {
background-color: rgba(255, 107, 107, 0.95); background-color: rgba(255, 255, 255, 0.95);
color: var(--on-primary); color: var(--primary);
padding: 16px; padding: 16px;
box-shadow: 0 4px 20px rgba(0,0,0,0.1); box-shadow: 0 4px 20px rgba(0,0,0,0.05);
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 100; z-index: 100;
@@ -171,8 +178,8 @@ body {
} }
.app-header:hover { .app-header:hover {
background-color: rgba(255, 107, 107, 1); background-color: rgba(255, 255, 255, 1);
box-shadow: 0 6px 24px rgba(0,0,0,0.15); box-shadow: 0 6px 24px rgba(0,0,0,0.08);
} }
.header-content { .header-content {
@@ -189,12 +196,16 @@ body {
position: relative; position: relative;
} }
.header-actions button {
color: var(--primary) !important; /* Override inline style */
}
/* Notification Badge Pulse */ /* Notification Badge Pulse */
.notification-badge { .notification-badge {
position: absolute; position: absolute;
top: 8px; top: 8px;
right: 8px; right: 8px;
background: var(--secondary); background: var(--error);
color: white; color: white;
font-size: 10px; font-size: 10px;
font-weight: bold; font-weight: bold;
@@ -238,15 +249,17 @@ body {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
background-color: rgba(255, 255, 255, 0.95); background-color: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(10px); backdrop-filter: blur(20px);
box-shadow: 0 -4px 20px rgba(0,0,0,0.1); box-shadow: 0 -4px 30px rgba(0,0,0,0.05);
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
padding: 12px 0; padding: 12px 0;
/* Android Safe Area Fix - Increased Padding */
padding-bottom: calc(24px + env(safe-area-inset-bottom));
z-index: 100; z-index: 100;
border-top-left-radius: 20px; border-top-left-radius: 24px;
border-top-right-radius: 20px; border-top-right-radius: 24px;
} }
.nav-item { .nav-item {
@@ -299,7 +312,8 @@ body {
max-width: 1200px; max-width: 1200px;
margin: 0 auto; margin: 0 auto;
padding: 16px; padding: 16px;
padding-bottom: 100px; /* Increased bottom padding to prevent content overlap with taller nav */
padding-bottom: calc(120px + env(safe-area-inset-bottom));
min-height: calc(100vh - 120px); min-height: calc(100vh - 120px);
position: relative; position: relative;
z-index: 1; z-index: 1;
@@ -381,7 +395,7 @@ body {
border-color: var(--primary); border-color: var(--primary);
background: linear-gradient(135deg, var(--primary-container), white); background: linear-gradient(135deg, var(--primary-container), white);
transform: scale(1.05); transform: scale(1.05);
box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2); box-shadow: 0 0 0 4px rgba(107, 144, 128, 0.2);
} }
.mood-emoji { .mood-emoji {
@@ -401,6 +415,97 @@ body {
100% { transform: scale(1.2); } 100% { transform: scale(1.2); }
} }
/* Progress Section */
.progress-container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 16px;
margin: 16px 0;
}
.progress-card {
background-color: var(--surface-variant);
border-radius: 12px;
padding: 16px;
text-align: center;
transition: all 0.3s ease;
}
.progress-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
background-color: white;
}
.progress-value {
font-size: 24px;
font-weight: 500;
color: var(--primary);
margin-bottom: 4px;
}
.progress-label {
font-size: 14px;
color: var(--on-surface-variant);
}
/* Chart Container */
.chart-container {
position: relative;
height: 250px;
background: rgba(255, 255, 255, 0.5);
border-radius: 16px;
padding: 16px;
}
/* Analytics Cards */
.analytics-card {
background: rgba(255, 255, 255, 0.6);
border-radius: 16px;
padding: 16px;
border: 1px solid rgba(255,255,255,0.5);
}
.analytics-card h4 {
margin: 0 0 12px 0;
color: var(--primary);
font-size: 16px;
}
.emotion-bar {
display: flex;
align-items: center;
margin-bottom: 8px;
}
.emotion-label {
flex: 1;
font-size: 14px;
}
.emotion-value {
width: 40px;
text-align: right;
font-size: 14px;
font-weight: 500;
}
.emotion-progress {
flex: 2;
height: 6px;
background: var(--surface-variant);
border-radius: 3px;
margin: 0 8px;
overflow: hidden;
}
.emotion-progress-fill {
height: 100%;
background: var(--primary);
border-radius: 3px;
transition: width 0.3s ease;
}
/* Buttons - Alive */ /* Buttons - Alive */
.btn { .btn {
padding: 16px 32px; padding: 16px 32px;
@@ -440,19 +545,19 @@ body {
.btn-primary { .btn-primary {
background: linear-gradient(45deg, var(--primary), var(--secondary)); background: linear-gradient(45deg, var(--primary), var(--secondary));
color: white; color: white;
box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4); box-shadow: 0 8px 20px rgba(107, 144, 128, 0.4);
animation: breathBtn 3s infinite ease-in-out; animation: breathBtn 3s infinite ease-in-out;
} }
@keyframes breathBtn { @keyframes breathBtn {
0% { transform: scale(1); box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4); } 0% { transform: scale(1); box-shadow: 0 8px 20px rgba(107, 144, 128, 0.4); }
50% { transform: scale(1.02); box-shadow: 0 12px 24px rgba(255, 107, 107, 0.6); } 50% { transform: scale(1.02); box-shadow: 0 12px 24px rgba(107, 144, 128, 0.6); }
100% { transform: scale(1); box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4); } 100% { transform: scale(1); box-shadow: 0 8px 20px rgba(107, 144, 128, 0.4); }
} }
.btn-primary:hover { .btn-primary:hover {
transform: translateY(-4px) scale(1.05); transform: translateY(-4px) scale(1.05);
box-shadow: 0 15px 30px rgba(255, 107, 107, 0.5); box-shadow: 0 15px 30px rgba(107, 144, 128, 0.5);
animation: none; /* Stop breathing on hover to focus */ animation: none; /* Stop breathing on hover to focus */
} }
@@ -490,20 +595,20 @@ body {
border-radius: 50%; border-radius: 50%;
background: var(--primary); background: var(--primary);
cursor: pointer; cursor: pointer;
box-shadow: 0 4px 10px rgba(255, 107, 107, 0.4); box-shadow: 0 4px 10px rgba(107, 144, 128, 0.4);
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.slider:hover::-webkit-slider-thumb { .slider:hover::-webkit-slider-thumb {
transform: scale(1.2); transform: scale(1.2);
box-shadow: 0 6px 15px rgba(255, 107, 107, 0.6); box-shadow: 0 6px 15px rgba(107, 144, 128, 0.6);
} }
textarea, input[type="text"] { textarea, input[type="text"] {
width: 100%; width: 100%;
padding: 16px; padding: 16px;
border-radius: 16px; border-radius: 16px;
border: 2px solid rgba(0,0,0,0.1); border: 2px solid rgba(0,0,0,0.05);
background: rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.9);
font-size: 16px; font-size: 16px;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
@@ -513,7 +618,7 @@ textarea, input[type="text"] {
textarea:focus, input[type="text"]:focus { textarea:focus, input[type="text"]:focus {
outline: none; outline: none;
border-color: var(--primary); border-color: var(--primary);
box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1); box-shadow: 0 0 0 4px rgba(107, 144, 128, 0.1);
transform: scale(1.01); transform: scale(1.01);
} }
@@ -607,7 +712,7 @@ textarea:focus, input[type="text"]:focus {
/* FAB - Alive */ /* FAB - Alive */
.fab { .fab {
position: fixed; position: fixed;
bottom: 90px; bottom: 110px; /* Increased from 90px */
right: 24px; right: 24px;
width: 64px; width: 64px;
height: 64px; height: 64px;
@@ -615,7 +720,7 @@ textarea:focus, input[type="text"]:focus {
background: linear-gradient(135deg, var(--primary), var(--secondary)); background: linear-gradient(135deg, var(--primary), var(--secondary));
color: white; color: white;
border: none; border: none;
box-shadow: 0 8px 25px rgba(255, 107, 107, 0.5); box-shadow: 0 8px 25px rgba(107, 144, 128, 0.5);
cursor: pointer; cursor: pointer;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -626,7 +731,7 @@ textarea:focus, input[type="text"]:focus {
.fab:hover { .fab:hover {
transform: scale(1.15) rotate(90deg); transform: scale(1.15) rotate(90deg);
box-shadow: 0 12px 35px rgba(255, 107, 107, 0.6); box-shadow: 0 12px 35px rgba(107, 144, 128, 0.6);
} }
.fab .material-icons { .fab .material-icons {
@@ -910,7 +1015,7 @@ textarea:focus, input[type="text"]:focus {
.form-input:focus { .form-input:focus {
background: white; background: white;
border-color: var(--primary); border-color: var(--primary);
box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.1); box-shadow: 0 0 0 4px rgba(107, 144, 128, 0.1);
transform: translateY(-2px); transform: translateY(-2px);
} }
@@ -950,3 +1055,138 @@ textarea:focus, input[type="text"]:focus {
from { opacity: 0; } from { opacity: 0; }
to { opacity: 1; } to { opacity: 1; }
} }
/* Smart Breathing Enhanced Styles */
.breathing-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: radial-gradient(circle at center, #1a2a6c, #b21f1f, #fdbb2d); /* Deep calming gradient */
background: radial-gradient(circle at center, #2b5876, #4e4376); /* Deep calming blue/purple */
z-index: 5000;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
color: white;
animation: fadeIn 0.5s ease;
}
.breathing-visual-container {
position: relative;
width: 300px;
height: 300px;
display: flex;
justify-content: center;
align-items: center;
margin-bottom: 40px;
}
.breath-circle-main {
width: 200px;
height: 200px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
backdrop-filter: blur(10px);
border: 2px solid rgba(255, 255, 255, 0.5);
box-shadow: 0 0 40px rgba(255, 255, 255, 0.2);
position: absolute;
transition: transform 0.1s linear, background-color 0.5s ease;
}
.breath-circle-inner {
width: 150px;
height: 150px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.8);
position: absolute;
box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
transition: transform 0.1s linear;
}
.breath-particles {
position: absolute;
width: 100%;
height: 100%;
animation: rotateParticles 20s linear infinite;
}
.breath-instruction-text {
font-size: 36px;
font-weight: 300;
letter-spacing: 2px;
text-align: center;
text-shadow: 0 2px 10px rgba(0,0,0,0.3);
margin-bottom: 10px;
min-height: 50px;
}
.breath-sub-text {
font-size: 18px;
opacity: 0.8;
margin-bottom: 40px;
}
.technique-selector {
display: flex;
gap: 12px;
margin-bottom: 30px;
overflow-x: auto;
padding: 10px;
max-width: 100%;
}
.technique-btn {
background: rgba(255, 255, 255, 0.15);
border: 1px solid rgba(255, 255, 255, 0.3);
padding: 12px 20px;
border-radius: 30px;
color: white;
cursor: pointer;
transition: all 0.3s;
white-space: nowrap;
}
.technique-btn.active {
background: white;
color: #4e4376;
font-weight: bold;
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.breath-controls {
display: flex;
gap: 20px;
}
.control-btn-icon {
width: 60px;
height: 60px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.2);
border: none;
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.3s;
}
.control-btn-icon:hover {
background: rgba(255, 255, 255, 0.4);
transform: scale(1.1);
}
@keyframes rotateParticles {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
/* Specific States */
.inhale .breath-circle-main { background: rgba(100, 255, 218, 0.3); }
.hold .breath-circle-main { background: rgba(255, 235, 59, 0.3); }
.exhale .breath-circle-main { background: rgba(255, 107, 107, 0.3); }