-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into yuri/add-tangle-dapp-pool-creation-docs
- Loading branch information
Showing
150 changed files
with
2,735 additions
and
544 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,8 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" | ||
fi | ||
dotenv_if_exists | ||
layout node | ||
use flake | ||
watch_file flake.nix | ||
# vi: ft=sh |
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ out/* | |
out | ||
.dccache | ||
*.code-workspace | ||
.direnv |
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,50 @@ | ||
import React from "react"; | ||
import { GrNodes } from "react-icons/gr"; | ||
import { BetweenVerticalEnd } from "lucide-react"; | ||
import Link from "next/link"; | ||
|
||
const BlueprintIntroCards = () => { | ||
const cards = [ | ||
{ | ||
icon: <BetweenVerticalEnd className="text-blue-500" size={24} />, | ||
title: "Tangle's Gadget SDK Repo", | ||
description: | ||
"Check out our Gadget SDK repository to get started building your own gadgets.", | ||
link: "https://github.com/tangle-network/gadget", | ||
}, | ||
{ | ||
icon: <BetweenVerticalEnd className="text-blue-500" size={24} />, | ||
title: "Hello World Blueprint", | ||
description: | ||
"Get started with a simple Hello World example using Tangle Blueprints.", | ||
link: "../developers/getting-started", | ||
}, | ||
{ | ||
icon: <GrNodes className="text-blue-500" size={24} />, | ||
title: "Build an Eigenlayer AVS", | ||
description: | ||
"Build an Eigenlayer AVS with the Tangle Blueprint SDK and hook into a variety of EVM compatible utilities for task automation, slashing, and more.", | ||
link: "../developers/eigenlayer-avs", | ||
}, | ||
]; | ||
|
||
return ( | ||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8 my-12"> | ||
{cards.map((card, index) => ( | ||
<Link href={card.link} key={index} className="block"> | ||
<div className="border border-black dark:border-white p-4 h-full flex flex-col transition-colors duration-300 hover:bg-purple-100 dark:hover:bg-purple-900"> | ||
<div className="flex-shrink-0 mb-2">{card.icon}</div> | ||
<h3 className="text-xl font-bold mb-4 text-black dark:text-white"> | ||
{card.title} | ||
</h3> | ||
<p className="text-sm flex-grow text-black dark:text-white"> | ||
{card.description} | ||
</p> | ||
</div> | ||
</Link> | ||
))} | ||
</div> | ||
); | ||
}; | ||
|
||
export default BlueprintIntroCards; |
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,146 @@ | ||
import React, { useState, useEffect, useCallback, useRef } from "react"; | ||
import { FiZoomIn, FiZoomOut, FiRefreshCw } from "react-icons/fi"; | ||
|
||
interface ExpandableImageProps { | ||
src: string; | ||
alt: string; | ||
allowZoom?: boolean; | ||
} | ||
|
||
const ExpandableImage: React.FC<ExpandableImageProps> = ({ | ||
src, | ||
alt, | ||
allowZoom = false, | ||
}) => { | ||
const [isExpanded, setIsExpanded] = useState(false); | ||
const [scale, setScale] = useState(1); | ||
const [position, setPosition] = useState({ x: 0, y: 0 }); | ||
const containerRef = useRef<HTMLDivElement>(null); | ||
const imageRef = useRef<HTMLImageElement>(null); | ||
|
||
// Ensure the src starts with a leading slash or is an absolute URL | ||
const imageSrc = | ||
src.startsWith("http") || src.startsWith("/") ? src : `/${src}`; | ||
|
||
const handleImageClick = () => { | ||
setIsExpanded(true); | ||
resetZoom(); | ||
}; | ||
|
||
const handleModalClick = useCallback(() => { | ||
setIsExpanded(false); | ||
resetZoom(); | ||
}, []); | ||
|
||
const resetZoom = () => { | ||
setScale(1); | ||
setPosition({ x: 0, y: 0 }); | ||
}; | ||
|
||
const handleZoomIn = () => { | ||
setScale((prevScale) => Math.min(prevScale + 0.5, 5)); | ||
}; | ||
|
||
const handleZoomOut = () => { | ||
setScale((prevScale) => Math.max(prevScale - 0.5, 1)); | ||
}; | ||
|
||
const handleScroll = useCallback( | ||
(event: WheelEvent) => { | ||
if (scale > 1) { | ||
event.preventDefault(); | ||
const sensitivity = 0.5; | ||
setPosition((prevPosition) => ({ | ||
x: prevPosition.x - event.deltaX * sensitivity, | ||
y: prevPosition.y - event.deltaY * sensitivity, | ||
})); | ||
} | ||
}, | ||
[scale], | ||
); | ||
|
||
useEffect(() => { | ||
const container = containerRef.current; | ||
if (isExpanded && container) { | ||
container.addEventListener("wheel", handleScroll, { passive: false }); | ||
} | ||
|
||
return () => { | ||
if (container) { | ||
container.removeEventListener("wheel", handleScroll); | ||
} | ||
}; | ||
}, [isExpanded, handleScroll]); | ||
|
||
return ( | ||
<> | ||
<div className="cursor-pointer hover:opacity-80 transition-opacity my-4"> | ||
<img | ||
src={imageSrc} | ||
alt={alt} | ||
width={800} | ||
height={600} | ||
onClick={handleImageClick} | ||
style={{ maxWidth: "100%", height: "auto" }} | ||
className="mx-auto" | ||
/> | ||
</div> | ||
{isExpanded && ( | ||
<div | ||
className="fixed inset-0 bg-black bg-opacity-80 flex justify-center items-center z-50" | ||
onClick={handleModalClick} | ||
> | ||
<div | ||
ref={containerRef} | ||
className="relative overflow-hidden" | ||
style={{ | ||
width: "90vw", | ||
height: "90vh", | ||
}} | ||
onClick={(e) => e.stopPropagation()} | ||
> | ||
<img | ||
ref={imageRef} | ||
src={imageSrc} | ||
alt={alt} | ||
style={{ | ||
width: "100%", | ||
height: "100%", | ||
objectFit: "contain", | ||
transform: `scale(${scale})`, | ||
transition: "transform 0.2s ease-out", | ||
cursor: allowZoom && scale > 1 ? "move" : "default", | ||
transformOrigin: "center", | ||
translate: `${position.x}px ${position.y}px`, | ||
}} | ||
/> | ||
{allowZoom && ( | ||
<div className="absolute bottom-4 right-4 flex space-x-2"> | ||
<button | ||
onClick={handleZoomIn} | ||
className="bg-white bg-opacity-50 p-2 rounded-full hover:bg-opacity-75 transition-colors" | ||
> | ||
<FiZoomIn size={24} /> | ||
</button> | ||
<button | ||
onClick={handleZoomOut} | ||
className="bg-white bg-opacity-50 p-2 rounded-full hover:bg-opacity-75 transition-colors" | ||
> | ||
<FiZoomOut size={24} /> | ||
</button> | ||
<button | ||
onClick={resetZoom} | ||
className="bg-white bg-opacity-50 p-2 rounded-full hover:bg-opacity-75 transition-colors" | ||
> | ||
<FiRefreshCw size={24} /> | ||
</button> | ||
</div> | ||
)} | ||
</div> | ||
</div> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default ExpandableImage; |
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
Oops, something went wrong.