copy button feedback and hmr
This commit is contained in:
parent
b92c371fd4
commit
3e7cea2063
2 changed files with 22 additions and 11 deletions
|
@ -13,12 +13,14 @@ const config = {
|
||||||
domains: ["avatars.githubusercontent.com", "lh3.googleusercontent.com"],
|
domains: ["avatars.githubusercontent.com", "lh3.googleusercontent.com"],
|
||||||
},
|
},
|
||||||
webpack: (config, { dev, isServer }) => {
|
webpack: (config, { dev, isServer }) => {
|
||||||
|
if (!dev && !isServer) {
|
||||||
Object.assign(config.resolve.alias, {
|
Object.assign(config.resolve.alias, {
|
||||||
"react/jsx-runtime.js": "preact/compat/jsx-runtime",
|
"react/jsx-runtime.js": "preact/compat/jsx-runtime",
|
||||||
react: "preact/compat",
|
react: "preact/compat",
|
||||||
"react-dom/test-utils": "preact/test-utils",
|
"react-dom/test-utils": "preact/test-utils",
|
||||||
"react-dom": "preact/compat",
|
"react-dom": "preact/compat",
|
||||||
});
|
});
|
||||||
|
}
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -71,6 +71,7 @@ const RoomBody: React.FC = () => {
|
||||||
|
|
||||||
const [storyNameText, setStoryNameText] = useState<string>("");
|
const [storyNameText, setStoryNameText] = useState<string>("");
|
||||||
const [roomScale, setRoomScale] = useState<string>("");
|
const [roomScale, setRoomScale] = useState<string>("");
|
||||||
|
const [copied, setCopied] = useState<boolean>(false);
|
||||||
|
|
||||||
const { data: roomFromDb, refetch: refetchRoomFromDb } =
|
const { data: roomFromDb, refetch: refetchRoomFromDb } =
|
||||||
api.room.get.useQuery({ id: roomId });
|
api.room.get.useQuery({ id: roomId });
|
||||||
|
@ -201,8 +202,12 @@ const RoomBody: React.FC = () => {
|
||||||
const copyRoomURLHandler = () => {
|
const copyRoomURLHandler = () => {
|
||||||
navigator.clipboard
|
navigator.clipboard
|
||||||
.writeText(window.location.href)
|
.writeText(window.location.href)
|
||||||
.then(() => {
|
.then(async () => {
|
||||||
console.log(`Copied Room Link to Clipboard!`);
|
console.log(`Copied Room Link to Clipboard!`);
|
||||||
|
setCopied(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setCopied(false);
|
||||||
|
}, 2000);
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log(`Error Copying Room Link to Clipboard!`);
|
console.log(`Error Copying Room Link to Clipboard!`);
|
||||||
|
@ -252,10 +257,14 @@ const RoomBody: React.FC = () => {
|
||||||
<div>{roomFromDb.id}</div>
|
<div>{roomFromDb.id}</div>
|
||||||
|
|
||||||
<button>
|
<button>
|
||||||
|
{copied ? (
|
||||||
|
<IoCheckmarkCircleOutline className="mx-1 text-green-400 animate-bounce" />
|
||||||
|
) : (
|
||||||
<IoCopyOutline
|
<IoCopyOutline
|
||||||
className="mx-1 hover:text-primary"
|
className="mx-1 hover:text-primary"
|
||||||
onClick={copyRoomURLHandler}
|
onClick={copyRoomURLHandler}
|
||||||
></IoCopyOutline>
|
></IoCopyOutline>
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue