Merge remote-tracking branch 'upstream/main'

pull/11/head
cssbubble 2022-05-31 10:11:25 +01:00
commit ab2de9d1ef
9 zmienionych plików z 16 dodań i 17 usunięć

Wyświetl plik

@ -1,2 +0,0 @@
topic,name,description,sequence
mathematics,Learn math in 21 minutes,,
1 topic name description sequence
2 mathematics Learn math in 21 minutes

Wyświetl plik

@ -1,2 +0,0 @@
name,description,category,photo,social_urls
Bill Gates,techbro,founder,,@billgates
1 name description category photo social_urls
2 Bill Gates techbro founder @billgates

Wyświetl plik

@ -1,6 +1,5 @@
rm learn.db
sqlite-utils insert learn.db creators db/creators.csv --csv
sqlite-utils insert learn.db topics db/topics.csv --csv
sqlite-utils insert learn.db items db/items.csv --csv
sqlite-utils insert learn.db reviews db/reviews.csv --csv
sqlite-utils insert learn.db courses db/courses.csv --csv

Wyświetl plik

@ -7,6 +7,10 @@
let result_items = [];
let result_topics = [];
function resetQuery(){
query = '';
}
$: query && fetch(`/learn/items.json?_shape=array&name__contains=${query}&_size=6`)
.then(r => r.json())
.then(data => {
@ -31,13 +35,13 @@
<div class="fixed z-10 inset-0 overflow-y-auto" on:click="{e => dispatch('closed',{}) }">
<div class="flex items-end sm:items-center justify-center min-h-full p-4 text-center sm:p-0">
<div class="mx-auto w-xl transform overflow-hidden rounded-xl bg-lightBg dark:bg-darkBg text-lightPrimary dark:darkPrimary shadow-2xl ring-1 ring-black ring-opacity-5 transition-all" on:click|stopPropagation>
<div class="w-md transform overflow-hidden rounded-xl bg-lightBg dark:bg-darkBg text-lightPrimary dark:darkPrimary shadow-2xl ring-1 ring-black ring-opacity-5 transition-all" on:click|stopPropagation>
<div class="relative">
<!-- Heroicon name: solid/search -->
<svg class="pointer-events-none absolute top-3.5 left-4 h-5 w-5 text-gray-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
</svg>
<input bind:value={query} type="text" class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-gray-800 placeholder-gray-400 focus:ring-0 sm:text-sm" placeholder="Search..." role="combobox" aria-expanded="false" aria-controls="options">
<input bind:value={query} type="text" class="h-12 w-full border-0 bg-transparent pl-11 pr-4 text-gray-800 placeholder-gray-400 focus:ring-0 sm:text-sm" placeholder="Search..." role="combobox" aria-expanded="false" aria-controls="options" autofocus>
</div>
{#if !query }
@ -59,7 +63,7 @@
<h2 class="bg-gray-100 py-2.5 px-4 text-xs font-semibold text-gray-900">Items</h2>
<ul class="mt-2 text-sm text-gray-800">
{#each result_items as item}
<li><a href="#/item/{item.rowid}" class="block cursor-default select-none px-4 py-2 hover:bg-indigo-600 hover:text-white cursor-pointer" id="option-1" role="option" tabindex="-1">{item.name}</a></li>
<li><a href="#/item/{item.rowid}" on:click={resetQuery} class="block cursor-default select-none px-4 py-2 hover:bg-indigo-600 hover:text-white cursor-pointer" role="option" tabindex="-1">{item.name}</a></li>
{/each}
</ul>
</li>
@ -67,7 +71,7 @@
<h2 class="bg-gray-100 py-2.5 px-4 text-xs font-semibold text-gray-900">Topics</h2>
<ul class="mt-2 text-sm text-gray-800">
{#each result_topics as topic}
<li><a href="#/topic/{topic.name}" class="block cursor-default select-none px-4 py-2 hover:bg-indigo-600 hover:text-white cursor-pointer" id="option-1" role="option" tabindex="-1">{topic.display_name}</a></li>
<li><a href="#/topic/{topic.name}" on:click={resetQuery} class="block cursor-default select-none px-4 py-2 hover:bg-indigo-600 hover:text-white cursor-pointer" role="option" tabindex="-1">{topic.display_name}</a></li>
{/each}
</ul>
</li>

Wyświetl plik

@ -19,7 +19,6 @@
let randomItemId;
let alltopics = [];
let showSearch = false;
let isActive;
function getRandomItemId(){
fetch('/learn.json?_shape=array&sql=select+rowid+from+items+order+by+random()+limit+1').then(r => r.json())
@ -44,6 +43,7 @@
window.location.hash = '/home';
currentView = '/home'
}
showSearch = false;
}
onMount(getRandomItemId);
@ -91,7 +91,7 @@
<ViewGridIcon class=" flex-shrink-0 h-6 w-6"/>
</NavButtonWithLabel>
<a href="#/random" on:click={getRandomItemId} class="text-lightSecondary1 hover:bg-lightSecondary1 hover:text-lightSecondary2 hover:dark:text-darkSecondary2 hover:dark:bg-darkPrimaryBg w-full group flex justify-start gap-3 items-center py-5 text-sm font-medium pl-4">
<a href="#/random" on:click={getRandomItemId} class={(currentView === "/random" ? 'bg-lightPrimCont text-lightPrimary dark:bg-darkPrimCont dark:text-darkPrimary' : '') + " text-lightSecondary1 w-full hover:bg-lightSecondary1 hover:dark:text-darkSecondary2 hover:dark:bg-darkPrimaryBg hover:text-lightSecondary2 group flex justify-start gap-3 items-center py-5 pl-4 text-sm font-medium"}>
<GiftIcon class=" flex-shrink-0 h-6 w-6"/>
<h3 class="text-center"> Random Item</h3>
</a>
@ -109,7 +109,7 @@
<BookmarkAltIcon class=" flex-shrink-0 h-6 w-6"/>
</NavButtonWithLabel>
<a href="/learn" class="text-indigo-100 hover:bg-lightSecondary1 hover:text-lightSecondary2 hover:dark:bg-darkPrimaryBg w-full group flex justify-start gap-3 items-center py-5 text-sm font-medium hover:dark:text-darkSecondary2 mb-5 pl-4">
<a href="/learn" target="_blank" class="text-indigo-100 hover:bg-lightSecondary1 hover:text-lightSecondary2 hover:dark:bg-darkPrimaryBg w-full group flex justify-start gap-3 items-center py-5 text-sm font-medium hover:dark:text-darkSecondary2 mb-5 pl-4">
<CogIcon class=" flex-shrink-0 h-6 w-6 "/>
<h3 class="text-center"> Datasette</h3>
</a>

Wyświetl plik

@ -23,6 +23,6 @@
</script>
<h1 class="my-10 text-lightButton2 dark:text-darkButton2">{kind == 0 ? 'Want to learn' : 'Finished learning'}</h1>
<h1 class="my-2 text-lightButton2 dark:text-darkButton2">{kind == 0 ? 'Want to learn' : 'Finished learning'}</h1>
<ItemList {items}/>

Wyświetl plik

@ -3,7 +3,7 @@
</script>
<h1 class="my-10">Learn from the following formats</h1>
<h1 class="my-2">Learn from the following formats</h1>
<div class=" mx-auto flex flex-wrap gap-5 justify-center items-center">
{#each formats as format}
<a href="#/format/{format.id}" class="w-64 flex flex-col rounded-lg shadow-md overflow-hidden transform transition ease-out duration-300 hover:scale-105 bg-lightPrimCont text-lightPrimary dark:bg-darkPrimCont dark:text-darkPrimary">

Wyświetl plik

@ -70,7 +70,7 @@
</style>
{#if item}
<h3 class="my-10 text-lightButton2 dark:text-darkSecondary2">
<h3 class="my-2 text-lightButton2 dark:text-darkSecondary2">
{#each item.topics.split(";") as topicname}
<a href={"#/topic/" + topicname} class="mr-2 font-bold text-lightSecondary2 dark:text-DarkSecondary2">{topicname}</a>
{/each}

Wyświetl plik

@ -66,7 +66,7 @@
</script>
<div class="my-10 text-lightButton2">
<div class="my-2 text-lightButton2">
<sl-breadcrumb>
<sl-breadcrumb-item href="#/topics" class="text-lg">All Topics</sl-breadcrumb-item>
{#if topic}