-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/frontend/src/lib/button/ListItemButtonIcon.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script lang="ts"> | ||
import type { IconDefinition } from '@fortawesome/free-solid-svg-icons'; | ||
import Fa from 'svelte-fa'; | ||
export let title: string; | ||
export let icon: IconDefinition; | ||
export let hidden = false; | ||
export let enabled: boolean = true; | ||
export let onClick: () => void = () => {console.log('==> 0')}; | ||
export let detailed = false; | ||
export let inProgress = false; | ||
export let iconOffset = ''; | ||
let positionLeftClass = 'left-1'; | ||
if (detailed) positionLeftClass = 'left-2'; | ||
let positionTopClass = 'top-1'; | ||
if (detailed) positionTopClass = '[0.2rem]'; | ||
const buttonDetailedClass = | ||
'text-gray-400 bg-charcoal-800 hover:text-violet-600 font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center'; | ||
const buttonDetailedDisabledClass = | ||
'text-gray-900 bg-charcoal-800 font-medium rounded-lg text-sm inline-flex items-center px-3 py-2 text-center'; | ||
const buttonClass = | ||
'm-0.5 text-gray-400 hover:bg-charcoal-600 hover:text-violet-600 font-medium rounded-full inline-flex items-center px-2 py-2 text-center'; | ||
const buttonDisabledClass = | ||
'm-0.5 text-gray-900 font-medium rounded-full inline-flex items-center px-2 py-2 text-center'; | ||
$: handleClick = enabled && !inProgress ? onClick : () => { console.log('==> 1')}; | ||
$: styleClass = detailed | ||
? enabled && !inProgress | ||
? buttonDetailedClass | ||
: buttonDetailedDisabledClass | ||
: enabled && !inProgress | ||
? buttonClass | ||
: buttonDisabledClass; | ||
</script> | ||
|
||
<button | ||
title="{title}" | ||
aria-label="{title}" | ||
on:click="{handleClick}" | ||
class="{styleClass} relative" | ||
class:disabled="{inProgress}" | ||
class:hidden="{hidden}"> | ||
<Fa class="h-4 w-4 {iconOffset}" icon="{icon}" /> | ||
<div | ||
aria-label="spinner" | ||
class="w-6 h-6 rounded-full animate-spin border border-solid border-violet-500 border-t-transparent absolute {positionTopClass} {positionLeftClass}" | ||
class:hidden="{!inProgress}"> | ||
</div> | ||
</button> |
19 changes: 19 additions & 0 deletions
19
packages/frontend/src/lib/table/model/ModelColumnActions.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<script lang="ts"> | ||
import type { ModelInfo } from "@shared/src/models/IModelInfo"; | ||
import { faTrash } from "@fortawesome/free-solid-svg-icons"; | ||
import ListItemButtonIcon from "../../button/ListItemButtonIcon.svelte"; | ||
import { studioClient } from "/@/utils/client"; | ||
export let object: ModelInfo; | ||
function deleteModel() { | ||
console.log('delete model', object.id); | ||
studioClient.deleteLocalModel(object.id); | ||
} | ||
</script> | ||
|
||
<ListItemButtonIcon | ||
icon={faTrash} | ||
onClick={() => deleteModel()} | ||
title="Delete Model" | ||
enabled={!object.state} | ||
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ export interface ModelInfo { | |
license: string; | ||
url: string; | ||
file?: LocalModelInfo; | ||
state?: 'deleting'; | ||
} |