mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-11 13:48:34 +00:00
prettier
This commit is contained in:
parent
47f65da621
commit
f47f5c1344
@ -36,12 +36,17 @@ export function Incrementor({ onChange, value, min = -Infinity, max = Infinity,
|
||||
className="w-32 my-0 border-none rounded-r-none bg-transparent appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
|
||||
/>
|
||||
<div className="flex gap-1 ">
|
||||
<IncButton label={'increment'} disabled={value <= min} onClick={() => onChange(value - 1)}>
|
||||
<IncButton label={'increment'} disabled={value <= min} onClick={() => onChange(value - 1)}>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" className="w-4 h-4">
|
||||
<path d="M3.75 7.25a.75.75 0 0 0 0 1.5h8.5a.75.75 0 0 0 0-1.5h-8.5Z" />
|
||||
</svg>
|
||||
</IncButton>
|
||||
<IncButton label={'decrement'} className="rounded-r-md" disabled={value >= max} onClick={() => onChange(value + 1)}>
|
||||
<IncButton
|
||||
label={'decrement'}
|
||||
className="rounded-r-md"
|
||||
disabled={value >= max}
|
||||
onClick={() => onChange(value + 1)}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" className="w-4 h-4">
|
||||
<path d="M8.75 3.75a.75.75 0 0 0-1.5 0v3.5h-3.5a.75.75 0 0 0 0 1.5h3.5v3.5a.75.75 0 0 0 1.5 0v-3.5h3.5a.75.75 0 0 0 0-1.5h-3.5v-3.5Z" />
|
||||
</svg>
|
||||
|
||||
@ -196,7 +196,7 @@ function PatternPageWithPagination({ patterns, patternOnClick, context, paginati
|
||||
);
|
||||
}
|
||||
|
||||
let featuredPageNum = 1
|
||||
let featuredPageNum = 1;
|
||||
function FeaturedPatterns({ context }) {
|
||||
const examplePatterns = useExamplePatterns();
|
||||
const collections = examplePatterns.collections;
|
||||
@ -215,13 +215,13 @@ function FeaturedPatterns({ context }) {
|
||||
}}
|
||||
paginationOnChange={async (pageNum) => {
|
||||
await loadAndSetFeaturedPatterns(pageNum);
|
||||
featuredPageNum = pageNum
|
||||
featuredPageNum = pageNum;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
let latestPageNum = 1
|
||||
let latestPageNum = 1;
|
||||
function LatestPatterns({ context }) {
|
||||
const examplePatterns = useExamplePatterns();
|
||||
const collections = examplePatterns.collections;
|
||||
@ -236,7 +236,7 @@ function LatestPatterns({ context }) {
|
||||
}}
|
||||
paginationOnChange={async (pageNum) => {
|
||||
await loadAndSetPublicPatterns(pageNum);
|
||||
latestPageNum = pageNum
|
||||
latestPageNum = pageNum;
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -29,7 +29,7 @@ export function Reference() {
|
||||
<div className="flex h-full w-full p-2 text-foreground overflow-hidden">
|
||||
<div className="h-full flex flex-col gap-2 w-1/3 max-w-72 ">
|
||||
<div class="w-full flex">
|
||||
<Textbox placeholder="Search" value={search} onChange={setSearch}/>
|
||||
<Textbox placeholder="Search" value={search} onChange={setSearch} />
|
||||
</div>
|
||||
<div className="flex flex-col h-full overflow-y-auto gap-1.5 bg-background bg-opacity-50 rounded-md">
|
||||
{visibleFunctions.map((entry, i) => (
|
||||
|
||||
@ -54,11 +54,7 @@ export function SoundsTab() {
|
||||
|
||||
return (
|
||||
<div id="sounds-tab" className="px-4 flex flex-col w-full h-full dark:text-white text-stone-900">
|
||||
<Textbox
|
||||
placeholder="Search"
|
||||
value={search}
|
||||
onChange={(v) => setSearch(v)}
|
||||
/>
|
||||
<Textbox placeholder="Search" value={search} onChange={(v) => setSearch(v)} />
|
||||
|
||||
<div className="pb-2 flex shrink-0 flex-wrap">
|
||||
<ButtonGroup
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { $featuredPatterns, $publicPatterns, patternFilterName } from '../user_pattern_utils.mjs';
|
||||
import { $featuredPatterns, $publicPatterns, patternFilterName } from '../user_pattern_utils.mjs';
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { useMemo } from 'react';
|
||||
import * as tunes from '../repl/tunes.mjs';
|
||||
|
||||
@ -199,4 +199,3 @@ export function setVersionDefaultsFrom(code) {
|
||||
console.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,8 +8,7 @@ import { confirmDialog, parseJSON, supabase } from './repl/util.mjs';
|
||||
export let $publicPatterns = atom([]);
|
||||
export let $featuredPatterns = atom([]);
|
||||
|
||||
|
||||
const patternQueryLimit = 20
|
||||
const patternQueryLimit = 20;
|
||||
export const patternFilterName = {
|
||||
public: 'latest',
|
||||
featured: 'featured',
|
||||
@ -49,40 +48,49 @@ export const setViewingPatternData = (data) => {
|
||||
};
|
||||
|
||||
function parsePageNum(page) {
|
||||
return isNaN(page) ? 0 : page
|
||||
return isNaN(page) ? 0 : page;
|
||||
}
|
||||
export function loadPublicPatterns(page) {
|
||||
page = parsePageNum(page)
|
||||
const offset = page * patternQueryLimit
|
||||
return supabase.from('code_v1').select().eq('public', true).range(offset, offset + patternQueryLimit ).order('id', { ascending: false });
|
||||
page = parsePageNum(page);
|
||||
const offset = page * patternQueryLimit;
|
||||
return supabase
|
||||
.from('code_v1')
|
||||
.select()
|
||||
.eq('public', true)
|
||||
.range(offset, offset + patternQueryLimit)
|
||||
.order('id', { ascending: false });
|
||||
}
|
||||
|
||||
export function loadFeaturedPatterns(page = 0) {
|
||||
page = parsePageNum(page)
|
||||
const offset = page * patternQueryLimit
|
||||
return supabase.from('code_v1').select().eq('featured', true).range(offset, offset + patternQueryLimit).order('id', { ascending: false });
|
||||
page = parsePageNum(page);
|
||||
const offset = page * patternQueryLimit;
|
||||
return supabase
|
||||
.from('code_v1')
|
||||
.select()
|
||||
.eq('featured', true)
|
||||
.range(offset, offset + patternQueryLimit)
|
||||
.order('id', { ascending: false });
|
||||
}
|
||||
|
||||
export async function loadAndSetPublicPatterns(page) {
|
||||
const p = await loadPublicPatterns(page);
|
||||
const data = p?.data
|
||||
const pats = {}
|
||||
const data = p?.data;
|
||||
const pats = {};
|
||||
data?.forEach((data, key) => (pats[data.id ?? key] = data));
|
||||
$publicPatterns.set(pats)
|
||||
$publicPatterns.set(pats);
|
||||
}
|
||||
export async function loadAndSetFeaturedPatterns(page) {
|
||||
|
||||
const p = await loadFeaturedPatterns(page);
|
||||
const data = p?.data
|
||||
const pats = {}
|
||||
const data = p?.data;
|
||||
const pats = {};
|
||||
data?.forEach((data, key) => (pats[data.id ?? key] = data));
|
||||
$featuredPatterns.set(pats)
|
||||
$featuredPatterns.set(pats);
|
||||
}
|
||||
|
||||
export async function loadDBPatterns() {
|
||||
try {
|
||||
await loadAndSetPublicPatterns()
|
||||
await loadAndSetFeaturedPatterns()
|
||||
await loadAndSetPublicPatterns();
|
||||
await loadAndSetFeaturedPatterns();
|
||||
} catch (err) {
|
||||
console.error('error loading patterns', err);
|
||||
}
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
|
||||
const defaultTheme = require('tailwindcss/defaultTheme');
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
darkMode: 'class',
|
||||
content: [
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
// utility for combining class names
|
||||
export function cn(...classes) {
|
||||
return classes.filter(Boolean).join(' ');
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user