Spaces:
Sleeping
Sleeping
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Simple CMS</title> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| min-height: 100vh; | |
| padding: 20px; | |
| } | |
| .container { | |
| max-width: 1200px; | |
| margin: 0 auto; | |
| } | |
| .auth-box { | |
| max-width: 400px; | |
| margin: 100px auto; | |
| background: white; | |
| padding: 40px; | |
| border-radius: 10px; | |
| box-shadow: 0 10px 40px rgba(0,0,0,0.2); | |
| } | |
| h1, h2 { | |
| color: #333; | |
| margin-bottom: 20px; | |
| } | |
| .auth-box h2 { | |
| text-align: center; | |
| color: #667eea; | |
| } | |
| .form-group { | |
| margin-bottom: 20px; | |
| } | |
| label { | |
| display: block; | |
| margin-bottom: 5px; | |
| color: #555; | |
| font-weight: 500; | |
| } | |
| input[type="text"], | |
| input[type="password"], | |
| textarea { | |
| width: 100%; | |
| padding: 12px; | |
| border: 2px solid #e0e0e0; | |
| border-radius: 6px; | |
| font-size: 14px; | |
| transition: border-color 0.3s; | |
| } | |
| input[type="text"]:focus, | |
| input[type="password"]:focus, | |
| textarea:focus { | |
| outline: none; | |
| border-color: #667eea; | |
| } | |
| textarea { | |
| resize: vertical; | |
| min-height: 100px; | |
| font-family: inherit; | |
| } | |
| button { | |
| width: 100%; | |
| padding: 12px; | |
| background: #667eea; | |
| color: white; | |
| border: none; | |
| border-radius: 6px; | |
| font-size: 16px; | |
| font-weight: 600; | |
| cursor: pointer; | |
| transition: background 0.3s; | |
| } | |
| button:hover { | |
| background: #5568d3; | |
| } | |
| .link { | |
| text-align: center; | |
| margin-top: 15px; | |
| color: #666; | |
| } | |
| .link a { | |
| color: #667eea; | |
| text-decoration: none; | |
| font-weight: 600; | |
| } | |
| .link a:hover { | |
| text-decoration: underline; | |
| } | |
| .dashboard-header { | |
| background: white; | |
| padding: 20px 30px; | |
| border-radius: 10px; | |
| margin-bottom: 30px; | |
| display: flex; | |
| justify-content: space-between; | |
| align-items: center; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| } | |
| .dashboard-header h1 { | |
| margin: 0; | |
| color: #667eea; | |
| } | |
| .user-info { | |
| color: #666; | |
| } | |
| .logout-btn { | |
| width: auto; | |
| padding: 8px 20px; | |
| background: #764ba2; | |
| margin-left: 20px; | |
| } | |
| .logout-btn:hover { | |
| background: #653a8a; | |
| } | |
| .note-form { | |
| background: white; | |
| padding: 30px; | |
| border-radius: 10px; | |
| margin-bottom: 30px; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| } | |
| .note-form textarea { | |
| min-height: 120px; | |
| } | |
| .note-form button { | |
| margin-top: 10px; | |
| } | |
| .notes-grid { | |
| display: grid; | |
| grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); | |
| gap: 20px; | |
| } | |
| .note-card { | |
| background: white; | |
| padding: 20px; | |
| border-radius: 10px; | |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); | |
| transition: transform 0.2s, box-shadow 0.2s; | |
| position: relative; | |
| } | |
| .note-card:hover { | |
| transform: translateY(-5px); | |
| box-shadow: 0 5px 20px rgba(0,0,0,0.15); | |
| } | |
| .note-timestamp { | |
| font-size: 12px; | |
| color: #999; | |
| margin-bottom: 10px; | |
| } | |
| .note-content { | |
| color: #333; | |
| line-height: 1.6; | |
| word-wrap: break-word; | |
| white-space: pre-wrap; | |
| } | |
| .delete-btn { | |
| position: absolute; | |
| top: 15px; | |
| right: 15px; | |
| background: #ff4757; | |
| color: white; | |
| border: none; | |
| border-radius: 50%; | |
| width: 30px; | |
| height: 30px; | |
| cursor: pointer; | |
| font-size: 18px; | |
| line-height: 1; | |
| transition: background 0.3s; | |
| padding: 0; | |
| } | |
| .delete-btn:hover { | |
| background: #ee384a; | |
| } | |
| .flash-messages { | |
| max-width: 1200px; | |
| margin: 0 auto 20px; | |
| } | |
| .flash { | |
| padding: 15px 20px; | |
| border-radius: 6px; | |
| margin-bottom: 10px; | |
| } | |
| .flash.success { | |
| background: #d4edda; | |
| color: #155724; | |
| border: 1px solid #c3e6cb; | |
| } | |
| .flash.error { | |
| background: #f8d7da; | |
| color: #721c24; | |
| border: 1px solid #f5c6cb; | |
| } | |
| .empty-state { | |
| text-align: center; | |
| padding: 60px 20px; | |
| color: white; | |
| font-size: 18px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| {% with messages = get_flashed_messages(with_categories=true) %} | |
| {% if messages %} | |
| <div class="flash-messages"> | |
| {% for category, message in messages %} | |
| <div class="flash {{ category }}">{{ message }}</div> | |
| {% endfor %} | |
| </div> | |
| {% endif %} | |
| {% endwith %} | |
| {% if page == 'login' %} | |
| <div class="auth-box"> | |
| <h2>Login</h2> | |
| <form method="POST" action="/login"> | |
| <div class="form-group"> | |
| <label for="username">Username</label> | |
| <input type="text" id="username" name="username" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="password">Password</label> | |
| <input type="password" id="password" name="password" required> | |
| </div> | |
| <button type="submit">Login</button> | |
| </form> | |
| <div class="link"> | |
| Don't have an account? <a href="/signup">Sign up</a> | |
| </div> | |
| </div> | |
| {% elif page == 'signup' %} | |
| <div class="auth-box"> | |
| <h2>Sign Up</h2> | |
| <form method="POST" action="/signup"> | |
| <div class="form-group"> | |
| <label for="username">Username</label> | |
| <input type="text" id="username" name="username" required> | |
| </div> | |
| <div class="form-group"> | |
| <label for="password">Password</label> | |
| <input type="password" id="password" name="password" required> | |
| </div> | |
| <button type="submit">Sign Up</button> | |
| </form> | |
| <div class="link"> | |
| Already have an account? <a href="/">Login</a> | |
| </div> | |
| </div> | |
| {% elif page == 'dashboard' %} | |
| <div class="container"> | |
| <div class="dashboard-header"> | |
| <h1>My Notes</h1> | |
| <div style="display: flex; align-items: center;"> | |
| <span class="user-info">Welcome, <strong>{{ username }}</strong></span> | |
| <a href="/logout"><button class="logout-btn">Logout</button></a> | |
| </div> | |
| </div> | |
| <div class="note-form"> | |
| <h2>Add New Note</h2> | |
| <form method="POST" action="/add_note"> | |
| <textarea name="content" placeholder="Write your note here..." required></textarea> | |
| <button type="submit">Add Note</button> | |
| </form> | |
| </div> | |
| {% if notes %} | |
| <div class="notes-grid"> | |
| {% for note in notes %} | |
| <div class="note-card"> | |
| <a href="/delete_note/{{ note.filename }}" onclick="return confirm('Delete this note?')"> | |
| <button class="delete-btn" title="Delete note">×</button> | |
| </a> | |
| <div class="note-timestamp">{{ note.timestamp.replace('_', ' ') }}</div> | |
| <div class="note-content">{{ note.content }}</div> | |
| </div> | |
| {% endfor %} | |
| </div> | |
| {% else %} | |
| <div class="empty-state"> | |
| <p>No notes yet. Add your first note above!</p> | |
| </div> | |
| {% endif %} | |
| </div> | |
| {% endif %} | |
| </body> | |
| </html> | |