diff --git a/client/src/App.css b/client/src/App.css
index c51f84a..a4f5a35 100644
--- a/client/src/App.css
+++ b/client/src/App.css
@@ -149,4 +149,26 @@ li {
}
#oriurl {
margin: 50px;
+}
+#shorturl {
+ margin: 50px;
+}
+
+
+#button_copy {
+ height: 100px;
+ width: 300px;
+ font-size: x-large;
+ border-radius: 15px;
+ will-change: filter;
+ transition: filter 400ms;
+}
+#button_copy:hover {
+ filter: drop-shadow(0 0 0.5em #f29732);
+ border-color: transparent;
+ transition: 0.3s;
+}
+#button_copy:active {
+ border-color: transparent;
+ background-color: transparent;
}
\ No newline at end of file
diff --git a/client/src/Home.tsx b/client/src/Home.tsx
index e46a94e..a5c7008 100644
--- a/client/src/Home.tsx
+++ b/client/src/Home.tsx
@@ -8,18 +8,18 @@ const Home = () => {
-
+
trx shortlink
@@ -38,8 +38,11 @@ const Home = () => {
export default Home;
async function shortenLink(url: string) {
- if ((document.getElementById("oriurl") as HTMLInputElement).value == "") {
+ const inputi = (document.getElementById("oriurl") as HTMLInputElement).value;
+ if (inputi == "") {
alert("The url cannot be empty!")
+ } else if(!(inputi.startsWith("https://") || inputi.startsWith("http://"))) {
+ alert("Please provide a valid url!")
} else {
const res = await fetch("http://localhost:3000/api/shorten", {
method: "POST",
@@ -49,7 +52,7 @@ async function shortenLink(url: string) {
const data = await res.json();
console.log(data.short_url);
(document.getElementById("oriurl") as HTMLInputElement).value = ""
- location.href = "link/" + data.id;
+ location.href = "/link/" + data.id;
return data.id;
}
}
diff --git a/client/src/main.tsx b/client/src/main.tsx
index 4de0d8a..f3d8317 100644
--- a/client/src/main.tsx
+++ b/client/src/main.tsx
@@ -3,6 +3,7 @@ import './index.css';
import Home from './Home.tsx';
import Login from './pages/login.tsx'
import Copylink from './pages/copylink.tsx';
+import Admin from './pages/admin.tsx';
import {
BrowserRouter as Router,
@@ -22,6 +23,10 @@ createRoot(document.getElementById('root')!).render(
path='/login'
element={
}
/>
+
}
+ />
}
diff --git a/client/src/pages/admin.tsx b/client/src/pages/admin.tsx
new file mode 100644
index 0000000..7611ab5
--- /dev/null
+++ b/client/src/pages/admin.tsx
@@ -0,0 +1,40 @@
+import shortlinkLogo from '../assets/trx-shortlink-orange.png'
+import '../App.css'
+
+const Admin = () => {
+ return (
+ <>
+
+
+
+
+
+
trx shortlink
+
+
+
Admin Panel
+
+
+
+
+ >
+ );
+};
+
+export default Admin;
+
+
diff --git a/client/src/pages/copylink.tsx b/client/src/pages/copylink.tsx
index 103be30..ef9eb86 100644
--- a/client/src/pages/copylink.tsx
+++ b/client/src/pages/copylink.tsx
@@ -1,8 +1,11 @@
import shortlinkLogo from '../assets/trx-shortlink-orange.png'
import '../App.css'
+import { useParams } from 'react-router-dom';
const Copylink = () => {
+ const { id } = useParams<{ id: string }>();
+
return (
<>
@@ -14,20 +17,20 @@ const Copylink = () => {