Compare commits

..

No commits in common. "020f3cbd740bca83faa244520d80b02e0ea49408" and "a3cd614c61c44e09f39e09073704cbc57fdb566b" have entirely different histories.

3 changed files with 18 additions and 38 deletions

View file

@ -33,7 +33,7 @@
You have no lists yet! <Link to="/lists/create" class="text-blue-400"
>Create one now</Link
>
{:else}
{/if}
{#each lists.teams as list}
<Link class="text-blue-400" to="/list/{list['$id']}"
>{list["name"]}</Link
@ -43,7 +43,6 @@
class="text-blue-400 dark:bg-gray-600 bg-gray-400 border p-1 mt-4 rounded"
to="/lists/create">Create new list</Link
>
{/if}
{/await}
</div>
</main>

View file

@ -15,7 +15,6 @@
let listname = "";
let requireLoggedIn = false;
let list_type = "";
function createList(e) {
e.preventDefault();
@ -23,9 +22,8 @@
database
.createDocument("tehillim-split", "lists", ID.unique(), {
title: listname,
require_logged_in: !!requireLoggedIn,
require_logged_in: requireLoggedIn,
owner_id: loggedInUser["$id"],
list_type: list_type
})
.then((r) => {
teams.create(r["$id"], listname, ["owner"]).then((r) => {
@ -68,24 +66,13 @@
<legend class="text-2xl">Create new list</legend>
<input
class="dark:bg-gray-500 dark:placeholder-white border border-black dark:border-current rounded p-2 w-72"
class="dark:bg-gray-500 dark:placeholder-white border border-black dark:border-current rounded p-1"
type="text"
placeholder="List name"
bind:value={listname}
required
/> <br />
<select
class="dark:bg-gray-500 dark:placeholder-white border border-black dark:border-current rounded p-2 mt-2 w-72"
placeholder="Split Tehillim by"
bind:value={list_type}
required
>
<option value="" selected disabled>Split Tehillim by</option>
<option value="perakim">Perakim</option>
<option value="month">Days of the month</option>
</select> <br />
<input
class="w-5 h-5 border-solid border-white my-3"
name="requireLoggedIn"

View file

@ -7,14 +7,7 @@
export let id;
let elementsNumbers = 0;
let list = database.getDocument("tehillim-split", "lists", id);
list.then((r) => {
if (r.list_type == "perakim") elementsNumbers = 151;
if (r.list_type == "month") elementsNumbers = 31;
});
let perakim = [];
let perakimPromise = database
.listDocuments("tehillim-split", "perakim", [Query.equal("list_id", [id])])
@ -149,7 +142,6 @@
Loading...
{:then list}
<h1 class="text-2xl">List {list.title}</h1>
<p>List split by {list.list_type=="perakim"?"perek":""}{list.list_type=="month"?"days of month":""}</p>
<br />
<Link class="text-blue-400" to="/list/{id}/members">Members</Link>
{#await teamDetails then team}
@ -163,17 +155,17 @@
{/if}
{/await}<br />
{#await perakimPromise then perakimResolved}
{#each Array.from(Array(elementsNumbers).keys()).slice(1) as i}
{list.list_type == "perakim" ? "Perek " + i : ""}
{list.list_type == "month" ? "Day " + i : ""}
{#each Array.from(Array(150 + 1).keys()).slice(1) as i}
{#if perekIndex(i) !== -1}
{#if perakim[perekIndex(i)].taken == false}
Perek {i}
<button
on:click={() => takePerek(i)}
class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded"
>Take</button
>
{:else if perakim[perekIndex(i)].taken_by == loggedInUser["$id"] && perakim[perekIndex(i)].completed !== true}
Perek {i}
<button
on:click={() => untakePerek(i)}
class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded"
@ -185,17 +177,19 @@
>Complete</button
>
{:else if perakim[perekIndex(i)].taken_by == loggedInUser["$id"] && perakim[perekIndex(i)].completed == true}
Perek {i}
<button
on:click={() => uncompletePerek(i)}
class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded"
>Uncomplete</button
>
{:else if perakim[perekIndex(i)].completed == false}
- Taken by {perakim[perekIndex(i)].taken_by_name}
Perek {i} - Taken by {perakim[perekIndex(i)].taken_by_name}
{:else}
- Completed by {perakim[perekIndex(i)].taken_by_name}
Perek {i} - Completed by {perakim[perekIndex(i)].taken_by_name}
{/if}
{:else}
Perek {i}
<button
on:click={() => takeNewPerek(i)}
class="dark:bg-gray-600 bg-gray-400 border p-1 mt-2 rounded"