Skip to content

Commit

Permalink
feat: 채팅 저장소 클립 보드 저장시 알림 띄우기 (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyechan99 committed Feb 14, 2024
1 parent b41d3ec commit 5d21969
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Chzzk Plus",
"description": "네이버 스트리밍 서비스 Chzzk Plus",
"version": "1.0.11",
"version": "1.0.12",
"manifest_version": 3,
"icons": {
"16": "icon16.png",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "chzzk-plus",
"private": true,
"version": "1.0.11",
"version": "1.0.12",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function App() {
<hr />

<p className="description">* 표시된 설정은 새로고침 후 적용됩니다</p>
<p className="version">v1.0.11</p>
<p className="version">v1.0.12</p>
</div>
);
}
Expand Down
18 changes: 15 additions & 3 deletions src/components/Global.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
background: #141517;
z-index: 1000;
overflow-y: auto;
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
.czp-global::-webkit-scrollbar {
display: none;
Expand Down Expand Up @@ -104,4 +104,16 @@
}
.czp-chat-st-remove-btn:hover {
background-color: #353535;
}
}

.czp-storage-message {
position: absolute;
background-color: white;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 0.25rem;
padding: 1rem 2rem;
font-size: 1.5rem;
font-family: "Sandoll Nemony2";
}
19 changes: 19 additions & 0 deletions src/components/Global.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
const MessageStorage = () => {
const [storage, setStorage] = useState<string[]>([]);
const [text, setText] = useState<string>("");
const [showCopied, setShowCopied] = useState<boolean>(false);

// 저장되어있는 storage 불러오기
useEffect(() => {
Expand All @@ -21,6 +22,7 @@ const MessageStorage = () => {

// 메세지 클립보드에 복사
const copyMessage = (data: string) => {
setShowCopied(true);
navigator.clipboard.writeText(data).then(() => {});
};

Expand All @@ -44,6 +46,22 @@ const MessageStorage = () => {
});
};

useEffect(() => {
let timeoutId: number;

if (showCopied) {
timeoutId = setTimeout(() => {
setShowCopied(false);
}, 1000);
}

return () => {
if (timeoutId) {
clearTimeout(timeoutId);
}
};
}, [showCopied]);

return (
<>
<h2 className="czp-storage-heading">채팅 저장소</h2>
Expand Down Expand Up @@ -89,6 +107,7 @@ const MessageStorage = () => {
</div>
))}
</div>
{showCopied && <div className="czp-storage-message">복사되었습니다.</div>}
</>
);
};
Expand Down

0 comments on commit 5d21969

Please sign in to comment.