返回代码库

骑行里程记录App

4.0
en健康与健身骑行里程记录健康生活

提示语

Create a bike kilometer reading app

生成结果

import React, { useState } from 'react';

const App = () => {
  const [kilometers, setKilometers] = useState(0);
  const [history, setHistory] = useState([]);

  const addKilometers = () => {
    const newKilometers = parseFloat(prompt('Enter kilometers ridden:'));
    if (!isNaN(newKilometers) && newKilometers > 0) {
      setKilometers(kilometers + newKilometers);
      setHistory([...history, newKilometers]);
    } else {
      alert('Please enter a valid number of kilometers.');
    }
  };

  const resetKilometers = () => {
    setKilometers(0);
    setHistory([]);
  };

  return (
    <div className="min-h-screen bg-gradient-to-r from-blue-500 to-purple-600 text-white p-8">
      <div className="max-w-4xl mx-auto">
        <h1 className="text-4xl font-bold mb-8 text-center">Bike Kilometer Tracker</h1>
        <div className="bg-white bg-opacity-10 p-6 rounded-lg shadow-lg">
          <div className="text-2xl mb-4">Total Kilometers: {kilometers.toFixed(2)} km</div>
          <div className="flex space-x-4">
            <button
              onClick={addKilometers}
              className="bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded transition duration-300"
            >
              Add Kilometers
            </button>
            <button
              onClick={resetKilometers}
              className="bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded transition duration-300"
            >
              Reset
            </button>
          </div>
        </div>
        <div className="mt-8">
          <h2 className="text-2xl font-bold mb-4">Ride History</h2>
          <ul className="space-y-2">
            {history.map((km, index) => (
              <li key={index} className="bg-white bg-opacity-10 p-3 rounded-lg">
                Ride {index + 1}: {km.toFixed(2)} km
              </li>
            ))}
          </ul>
        </div>
      </div>
      <footer className="mt-12 text-center text-sm text-white opacity-75">
        © 2025 Bike Kilometer Tracker. All rights reserved.
      </footer>
    </div>
  );
};

export default App;

更多推荐

查看全部

MindCare 心理健康应用

健康与健身en
4.0

🟩 1. Splash Screen Logo + Tagline “MindCare – feel better live better” Loading animation. 🟦 2. Onboarding Slides (3 screens, swipeable) Slide 1: “Take control of your mental well-being.” Illustration: Calm user meditating. Slide 2: “Talk to experts, join support groups, or just vent in a safe space.” Illustration: Therapist talking to client. Slide 3: “Private. Secure. In Arabic. Anytime, anywhere.” CTA: "Get Started" 🟩 3. Sign Up / Log In Screen Options: ✅ Sign up with email ✅ Continue with Google ✅ Already have an account? Log in 🟦 4. User Profile Setup Choose: ▪ Gender ▪ Age range ▪ Mental health goals (ex: anxiety, sleep, stress relief) ▪ Preferred therapy mode: Text / Video / Home Visit ▪ Select Language: (Arabic / French / English) 🟩 5. Home Dashboard Navigation bar (bottom): 🧠 AI Helper | 🧍 Therapist | 🤝 Group | 📚 Content | 👤 Profile Main sections: ▪ "Talk to your AI Supporter" ▪ "Upcoming session with Dr. Yasmine" ▪ "New content for you today" ▪ "Join a live support room" 🟦 6. AI Helper (Smart Assistant) Chat interface with your 24/7 AI support Prompts: “I feel anxious.” “I want a breathing exercise.” “What does a panic attack feel like?” Options: ▪ Start mental scan ▪ Request a coping technique ▪ Schedule a session with therapist 🟩 7. Book a Therapy Session List of verified therapists (with specialties) Filters: gender, availability, language Book: ▪ Video session ▪ Audio call ▪ In-home visit (if city allows) Payment page ▪ Use credits or card ▪ Apply promo code 🟦 8. Group Support Rooms Live & scheduled themed sessions: ▪ “Anxiety Warriors” ▪ “Sleep & Calm Circle” ▪ “Divorce & Heartbreak Support” Features: ▪ Chat & mic on/off ▪ Moderated by psychologists ▪ Anonymous option 🟩 9. Interactive Exercises Daily recommended tasks: ▪ Mood journaling ▪ Guided breathing ▪ CBT reflections ▪ Positive affirmation builder Progress bar and badges for streaks 🟦 10. Mental Health Library Categories: ▪ Anxiety ▪ Depression ▪ Mindfulness ▪ Relationships ▪ Burnout Format: ▪ Short videos ▪ Podcasts ▪ Articles (Arabic dialect & MSA) 🟩 11. Notifications & Reminders “Your therapist appointment starts in 30 minutes.” “Time to check in with your mood.” “A new article on work stress is available.” 🟦 12. Profile & Settings Edit profile Session history Privacy settings Subscription management Language & theme 🟩 13. Emergency Help Red button: “Need urgent help?” ▪ Quick self-soothing techniques ▪ Call emergency number ▪ Crisis lines by country i want all this details in the app with some photos

心理健康AI助手在线治疗2025/6/18