Compare commits
4 Commits
1ff7fc454f
...
last_habit
Author | SHA1 | Date | |
---|---|---|---|
eff5be49c4 | |||
d13c490efb | |||
d98c208df9 | |||
85af85b1ee |
@@ -40,7 +40,7 @@ define('DB_NAME', 'your db name');
|
||||
3. Start an local web server
|
||||
- You can use php's integrated server by running this:
|
||||
```bash
|
||||
php -S localhost:8000
|
||||
php -S localhost:8000 -t ./public
|
||||
```
|
||||
- You can use any host and any port you want.
|
||||
|
||||
|
@@ -2,7 +2,10 @@
|
||||
|
||||
<section class="dashboard">
|
||||
<h1>Welcome, <?= htmlspecialchars($_SESSION['user']['username']) ?>!</h1>
|
||||
<a href="/habits/create" class="btn-primary">Create new habit!</a>
|
||||
<div>
|
||||
<a href="/habits/create" class="btn-green">Create new habit!</a>
|
||||
<a href="/habits" class="btn-primary">List all habits</a>
|
||||
</div>
|
||||
<div class="card-wrapper">
|
||||
<section class="card upcoming">
|
||||
<h2>Upcoming</h2>
|
||||
|
@@ -3,33 +3,22 @@
|
||||
<?php if (empty($this->get('habits'))): ?>
|
||||
<p>No habits yet. <a href="/habits/create">Create your first habit</a>.</p>
|
||||
<?php else: ?>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<th>Frequency</th>
|
||||
<th>Custom Schedule</th>
|
||||
<th>Points</th>
|
||||
<th>Created At</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($this->get('habits') as $habit): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($habit['title']) ?></td>
|
||||
<td><?= htmlspecialchars($habit['frequency']) ?></td>
|
||||
<td><?= htmlspecialchars($habit['custom_frequency'] ?? 'N/A') ?></td>
|
||||
<td><?= htmlspecialchars($habit['reward_points']) ?></td>
|
||||
<td><?= htmlspecialchars($habit['created_at']) ?></td>
|
||||
<td>
|
||||
<a href="/habits/edit?id=<?= $habit['id'] ?>">Edit</a> |
|
||||
<a href="/habits/delete?id=<?= $habit['id'] ?>" onclick="return confirm('Are you sure you want to delete this habit?')">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="/habits/create">Create new habit!</a>
|
||||
<div class="habits-wrapper">
|
||||
<?php foreach ($this->get('habits') as $habit): ?>
|
||||
<div class="habit bordered">
|
||||
<b><?= htmlspecialchars($habit['title']) ?></b>
|
||||
<p>Frequency: <?= htmlspecialchars($habit['frequency']) ?></p>
|
||||
<?php if (isset($habit['custom_frequency'])): ?>
|
||||
<p><?= htmlspecialchars($habit['custom_frequency'] ?? 'N/A') ?></p>
|
||||
<?php endif; ?>
|
||||
<p><?= htmlspecialchars($habit['reward_points']) ?></p>
|
||||
<p><?= htmlspecialchars($habit['created_at']) ?></p>
|
||||
<a href="/habits/done">Mark as done</a> |
|
||||
<a href="/habits/edit?id=<?= $habit['id'] ?>">Edit</a> |
|
||||
<a href="/habits/delete?id=<?= $habit['id'] ?>" onclick="return confirm('Are you sure you want to delete this habit?')">Delete</a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<a href="/habits/create" class="btn-green">Create new habit!</a>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
@@ -24,7 +24,7 @@
|
||||
<a href="/auth/signin">Log In</a>
|
||||
<a href="/auth/signup">Sign Up</a>
|
||||
<?php else: ?>
|
||||
<a href="/auth/logout">Sign out</a>
|
||||
<a href="/auth/logout" class="btn-secondary">Sign out</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:11.4 # LTS at 25. 12. 2025
|
||||
restart: always
|
||||
restart: on-failure:2
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: root
|
||||
ports:
|
||||
@@ -10,7 +10,7 @@ services:
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
restart: on-failure:2
|
||||
ports:
|
||||
- 8080:80
|
||||
environment:
|
||||
@@ -21,10 +21,11 @@ services:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
#volumes:
|
||||
# - .:/var/www/html
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
ports:
|
||||
- 8000:80
|
||||
depends_on:
|
||||
- mariadb
|
||||
restart: on-failure:2
|
||||
profiles: ["prod"]
|
||||
|
@@ -1,32 +1,47 @@
|
||||
@import url("https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Source+Code+Pro:ital,wght@0,200..900;1,200..900&display=swap");
|
||||
|
||||
body {
|
||||
font-family: "Open Sans", serif;
|
||||
background-color: var(--clr-primary);
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
font-family: "Open Sans", serif;
|
||||
background-color: var(--clr-primary);
|
||||
color: white;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: white;
|
||||
color: white;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin-top: .5rem;
|
||||
margin-bottom: 1rem;
|
||||
margin-top: .5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.btn-primary,
|
||||
.btn-secondary,
|
||||
.btn-tertiary,
|
||||
.btn-green,
|
||||
.btn-danger {
|
||||
background-color: var(--clr-green);
|
||||
padding: .5rem;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border-radius: var(--border-radious);
|
||||
border: var(--borderWidth-thin) solid var(--clr-border);
|
||||
background-color: var(--clr-primary);
|
||||
padding: .5rem;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
border-radius: var(--border-radious);
|
||||
border: var(--borderWidth-thin) solid var(--clr-border);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: var(--clr-secondary);
|
||||
}
|
||||
|
||||
.btn-tertiary {
|
||||
background-color: var(--clr-tertiary);
|
||||
}
|
||||
|
||||
.btn-green {
|
||||
background-color: var(--clr-green);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background-color: var(--clr-danger-muted) !important;
|
||||
border: var(--borderWidth-thin) solid var(--clr-border-danger);
|
||||
background-color: var(--clr-danger-muted);
|
||||
border: var(--borderWidth-thin) solid var(--clr-border-danger);
|
||||
}
|
||||
|
@@ -1,26 +1,15 @@
|
||||
.habits h1 {
|
||||
font-size: 2rem;
|
||||
margin-bottom: 1rem;
|
||||
.habits-wrapper {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.habits table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
.habits .bordered {
|
||||
border-radius: var(--border-radious);
|
||||
border: var(--borderWidth-thin) solid var(--clr-border);
|
||||
width: 17rem;
|
||||
padding: 1rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.habits table th,
|
||||
.habits table td {
|
||||
border: 1px solid #ccc;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.habits a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.habits a:hover {
|
||||
text-decoration: underline;
|
||||
text-align: center;
|
||||
}
|
||||
|
@@ -7,6 +7,11 @@
|
||||
--clr-danger-muted: #f851491a;
|
||||
|
||||
--clr-link-blue: #4493f8;
|
||||
--clr-light-blue: #39a2ae;
|
||||
--clr-light-green: #71f79f;
|
||||
--clr-red: #9b1d20;
|
||||
--clr-orange: #e08e45;
|
||||
--clr-gray-blue: #627c85;
|
||||
|
||||
--border-radious: 5px;
|
||||
--borderWidth-thin: max(1px, 0.0625rem);
|
||||
|
Reference in New Issue
Block a user