implement searchOrCreate for boards
This commit is contained in:
Binary file not shown.
@@ -106,7 +106,7 @@ export default function implementFilter<T>(
|
|||||||
function update() {
|
function update() {
|
||||||
matches.clear();
|
matches.clear();
|
||||||
allItems.value.forEach((item: T) => {
|
allItems.value.forEach((item: T) => {
|
||||||
if (!itemToString(item).includes(query.value)) return;
|
if (!itemToString(item).toLowerCase().includes(query.value.toLowerCase())) return;
|
||||||
matches.add(item);
|
matches.add(item);
|
||||||
allItems.handleRemoval(item, () => {
|
allItems.handleRemoval(item, () => {
|
||||||
matches.remove(item);
|
matches.remove(item);
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -6,6 +6,7 @@ import { BoardViewModelToEntry } from "../Components/boardEntry";
|
|||||||
import * as React from "../../react";
|
import * as React from "../../react";
|
||||||
import TaskPageViewModel from "../../ViewModel/Pages/taskPageViewModel";
|
import TaskPageViewModel from "../../ViewModel/Pages/taskPageViewModel";
|
||||||
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||||
|
import {NewItemEntry} from "../Components/newItemEntry";
|
||||||
|
|
||||||
export function TaskPage(
|
export function TaskPage(
|
||||||
coreViewModel: CoreViewModel,
|
coreViewModel: CoreViewModel,
|
||||||
@@ -65,26 +66,13 @@ export function TaskPage(
|
|||||||
bind:value={taskPageViewModel.boardQuery}
|
bind:value={taskPageViewModel.boardQuery}
|
||||||
on:enter={taskPageViewModel.createBoard}
|
on:enter={taskPageViewModel.createBoard}
|
||||||
placeholder={
|
placeholder={
|
||||||
coreViewModel.translations.chatPage.task
|
coreViewModel.translations.general.filterOrCreateLabel
|
||||||
.newBoardNamePlaceholder
|
|
||||||
}
|
}
|
||||||
></input>
|
></input>
|
||||||
<button
|
|
||||||
class="primary"
|
|
||||||
aria-label={
|
|
||||||
coreViewModel.translations.chatPage.task
|
|
||||||
.createBoardButtonAudioLabel
|
|
||||||
}
|
|
||||||
on:click={taskPageViewModel.createBoard}
|
|
||||||
toggle:disabled={
|
|
||||||
taskPageViewModel.cannotCreateBoard
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span class="icon">add</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content">
|
<div class="content gap">
|
||||||
|
{NewItemEntry(coreViewModel, taskPageViewModel.boardQuery, taskPageViewModel.createBoard)}
|
||||||
<div
|
<div
|
||||||
class="grid gap"
|
class="grid gap"
|
||||||
style="grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr))"
|
style="grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr))"
|
||||||
|
|||||||
Binary file not shown.
@@ -6,7 +6,7 @@ export function BoardEntry(boardViewModel: BoardViewModel) {
|
|||||||
const view = (
|
const view = (
|
||||||
<button
|
<button
|
||||||
set:color={boardViewModel.color}
|
set:color={boardViewModel.color}
|
||||||
class="tile colored-tile"
|
class="tile colored-tile slide-up"
|
||||||
toggle:selected={boardViewModel.isSelected}
|
toggle:selected={boardViewModel.isSelected}
|
||||||
on:click={boardViewModel.select}
|
on:click={boardViewModel.select}
|
||||||
on:dragover={ViewController.allowDrop}
|
on:dragover={ViewController.allowDrop}
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import * as React from "../../react";
|
||||||
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
||||||
|
|
||||||
|
export function NewItemEntry(coreViewModel: CoreViewModel, query: React.State<string>, fn: ()=>void) {
|
||||||
|
const isHidden = React.createProxyState([query],()=>query.value == "");
|
||||||
|
const label = React.createProxyState([query],()=>coreViewModel.translations.general.createLabel(query.value));
|
||||||
|
|
||||||
|
return <button
|
||||||
|
class="standard slide-up"
|
||||||
|
toggle:hidden={isHidden}
|
||||||
|
on:click={fn}
|
||||||
|
>
|
||||||
|
<span subscribe:innerText={label}></span>
|
||||||
|
<span class="icon">add</span>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
+517
-519
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user