Compare commits

...

3 Commits

4 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,5 @@
# [0.1.0-develop.26](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.25...v0.1.0-develop.26) (2023-10-12)
# [0.1.0-develop.25](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.24...v0.1.0-develop.25) (2023-10-12)
# [0.1.0-develop.24](https://git.lumeweb.com/LumeWeb/sdk/compare/v0.1.0-develop.23...v0.1.0-develop.24) (2023-10-12)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/sdk",
"version": "0.1.0-develop.25",
"version": "0.1.0-develop.26",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/sdk",
"version": "0.1.0-develop.25",
"version": "0.1.0-develop.26",
"dependencies": {
"@lumeweb/kernel-network-registry-client": "0.1.0-develop.10",
"@lumeweb/libkernel": "0.1.0-develop.65",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/sdk",
"version": "0.1.0-develop.25",
"version": "0.1.0-develop.26",
"type": "module",
"main": "lib/index.js",
"types": "lib/src/index.d.ts",

View File

@ -15,8 +15,10 @@ const SYNCSTATE_TO_TEXT: Record<Network["syncState"], string> = {
export const LumeDashboardTrigger = Dialog.Trigger;
LumeDashboardTrigger.displayName = "LumeDashboardTrigger";
const LumeDashboard = ({children}: React.PropsWithChildren) => {
const { lume: { networks } } = useLume();
const LumeDashboard = ({ children }: React.PropsWithChildren) => {
const {
lume: { networks },
} = useLume();
const [uniqueNetworkTypes, setUniqueNetworkTypes] = useState<string[]>([]);
@ -26,22 +28,24 @@ const LumeDashboard = ({children}: React.PropsWithChildren) => {
setUniqueNetworkTypes(uniqueTypes);
}, [networks]);
const DefaultTrigger = () => (
const DefaultTrigger = (props: any) => (
<LumeDashboardTrigger asChild>
<button className="bg-primary text-primary-foreground p-2 px-4 text-sm font-semibold font-mono rounded-md">
<button
className="bg-primary text-primary-foreground p-2 px-4 text-sm font-semibold font-mono rounded-md"
{...props}>
Open Dashboard
</button>
</LumeDashboardTrigger>
);
const GivenTrigger = React.Children.toArray(children)
.filter((c) => {
console.log({component: c})
if(typeof c === 'object'){
console.log({ component: c });
if (typeof c === "object") {
//@ts-expect-error -- I dont know what the type of this should be, i just know that this works
return c.type?.displayName === "LumeDashboardTrigger"
return c.type?.displayName === "LumeDashboardTrigger";
}
return false
return false;
})
.at(0);
const Trigger = GivenTrigger ? () => GivenTrigger : DefaultTrigger;