-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #106 from Kanaries/dev
daily update merge
- Loading branch information
Showing
63 changed files
with
1,374 additions
and
847 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
build | ||
dist | ||
datasets | ||
public |
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 |
---|---|---|
|
@@ -4,4 +4,5 @@ import "gorm.io/gorm" | |
|
||
type Dataset struct { | ||
gorm.Model | ||
|
||
} |
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
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
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import React, { useCallback, useEffect, useState } from "react"; | ||
|
||
function classNames(...classes: string[]) { | ||
return classes.filter(Boolean).join(' ') | ||
} | ||
|
||
export interface ITabOption { | ||
label: string; | ||
key: string; | ||
} | ||
interface PureTabsProps { | ||
tabs: ITabOption[]; | ||
selectedKey: string; | ||
onSelected: (selectedKey: string, index: number) => void; | ||
allowEdit?: boolean; | ||
onEditLabel?: (label: string, index: number) => void; | ||
} | ||
export default function PureTabs(props: PureTabsProps) { | ||
const { tabs, selectedKey, onSelected, allowEdit, onEditLabel } = props; | ||
const [editList, setEditList] = useState<boolean[]>([]); | ||
const clearEditStatus = useCallback(() => { | ||
setEditList(new Array(tabs.length).fill(false)) | ||
}, [tabs.length]) | ||
useEffect(() => { | ||
clearEditStatus | ||
}, [clearEditStatus]) | ||
return ( | ||
<div className="border-b border-gray-200 overflow-x-auto" onMouseLeave={clearEditStatus}> | ||
<nav className="-mb-px flex border-gray-300 border-l" aria-label="Tabs"> | ||
{tabs.map((tab, tabIndex) => ( | ||
<span | ||
dangerouslySetInnerHTML={{ __html: tab.label }} | ||
onClick={() => { | ||
onSelected(tab.key, tabIndex) | ||
}} | ||
onDoubleClick={() => { | ||
setEditList(v => { | ||
const nv = [...v]; | ||
nv[tabIndex] = true; | ||
return nv | ||
}) | ||
}} | ||
contentEditable={editList[tabIndex]} | ||
onInput={(e) => { | ||
onEditLabel && onEditLabel(`${e.currentTarget.textContent}`, tabIndex) | ||
}} | ||
key={tab.key} | ||
className={classNames( | ||
tab.key === selectedKey | ||
? "border-transparent text-black bg-gray-100" | ||
: "text-gray-500 hover:text-gray-700 hover:border-gray-300", | ||
"whitespace-nowrap border-gray-300 py-1 px-2 border-t border-r botder-b text-sm cursor-pointer" | ||
)} | ||
/> | ||
))} | ||
</nav> | ||
</div> | ||
); | ||
} |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
Oops, something went wrong.