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>
|
||||||
|
}
|
||||||
@@ -22,6 +22,9 @@ const englishTranslations = {
|
|||||||
saveButton: "Save",
|
saveButton: "Save",
|
||||||
setButton: "Set",
|
setButton: "Set",
|
||||||
|
|
||||||
|
filterOrCreateLabel: "Search or create",
|
||||||
|
createLabel: (query: string) => `Create "${query}"`,
|
||||||
|
|
||||||
reloadAppButton: "Reload App",
|
reloadAppButton: "Reload App",
|
||||||
|
|
||||||
fileVersionLabel: "Version",
|
fileVersionLabel: "Version",
|
||||||
@@ -248,11 +251,6 @@ const englishTranslations = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
task: {
|
task: {
|
||||||
newBoardNamePlaceholder: "Create a board",
|
|
||||||
createBoardButtonAudioLabel: "create board",
|
|
||||||
|
|
||||||
///
|
|
||||||
|
|
||||||
noBoardSelected: "No board selected",
|
noBoardSelected: "No board selected",
|
||||||
boardNotFound: "Board not found",
|
boardNotFound: "Board not found",
|
||||||
|
|
||||||
@@ -360,6 +358,9 @@ export const allTranslations: {
|
|||||||
saveButton: "Speichern",
|
saveButton: "Speichern",
|
||||||
setButton: "OK",
|
setButton: "OK",
|
||||||
|
|
||||||
|
filterOrCreateLabel: "Suchen oder erstellen",
|
||||||
|
createLabel: (query: string) => `"${query}" erstellen`,
|
||||||
|
|
||||||
reloadAppButton: "Neu laden",
|
reloadAppButton: "Neu laden",
|
||||||
|
|
||||||
fileVersionLabel: "Version",
|
fileVersionLabel: "Version",
|
||||||
@@ -571,9 +572,6 @@ export const allTranslations: {
|
|||||||
},
|
},
|
||||||
|
|
||||||
task: {
|
task: {
|
||||||
newBoardNamePlaceholder: "Board erstellen",
|
|
||||||
createBoardButtonAudioLabel: "board erstellen",
|
|
||||||
|
|
||||||
noBoardSelected: "Kein Board ausgewählt",
|
noBoardSelected: "Kein Board ausgewählt",
|
||||||
boardNotFound: "Board nicht gefunden",
|
boardNotFound: "Board nicht gefunden",
|
||||||
|
|
||||||
@@ -662,6 +660,9 @@ export const allTranslations: {
|
|||||||
saveButton: "Guardar",
|
saveButton: "Guardar",
|
||||||
setButton: "OK",
|
setButton: "OK",
|
||||||
|
|
||||||
|
filterOrCreateLabel: "Buscar o crear",
|
||||||
|
createLabel: (query: string) => `Crear "${query}"`,
|
||||||
|
|
||||||
reloadAppButton: "Recargar app",
|
reloadAppButton: "Recargar app",
|
||||||
|
|
||||||
fileVersionLabel: "Versión",
|
fileVersionLabel: "Versión",
|
||||||
@@ -873,9 +874,6 @@ export const allTranslations: {
|
|||||||
},
|
},
|
||||||
|
|
||||||
task: {
|
task: {
|
||||||
newBoardNamePlaceholder: "Crear un tablero",
|
|
||||||
createBoardButtonAudioLabel: "crear tablero",
|
|
||||||
|
|
||||||
noBoardSelected: "Ningún tablero seleccionado",
|
noBoardSelected: "Ningún tablero seleccionado",
|
||||||
boardNotFound: "Tablero no encontrado",
|
boardNotFound: "Tablero no encontrado",
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user