Updated Shortener Admin Page

This commit is contained in:
itzMiney committed 2026-02-15 10:08:22 +01:00
1 parent 6fec6ce1c7
commit f948e2b082
4 files changed
+58 -4

No files matched your search

+21
View File
@@ -435,6 +435,18 @@
}
}
},
"node_modules/@angular/build/node_modules/@types/node": {
"version": "25.2.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.3.tgz",
"integrity": "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
},
"node_modules/@angular/build/node_modules/@vitejs/plugin-basic-ssl": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-2.1.0.tgz",
@@ -448,6 +460,15 @@
"vite": "^6.0.0 || ^7.0.0"
}
},
"node_modules/@angular/build/node_modules/undici-types": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
"dev": true,
"license": "MIT",
"optional": true,
"peer": true
},
"node_modules/@angular/build/node_modules/vite": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz",
+15
View File
@@ -124,3 +124,18 @@ li + li {
.url-list-items a:hover {
text-decoration: underline;
}
.copy-btn {
background: transparent;
color: #007bff;
border: none;
cursor: pointer;
font-size: 1rem;
font-weight: 500;
padding: 0;
margin-left: 4px;
}
.copy-btn:active, .copy-btn:focus {
color: #3e6c49;
}
+7 -4
View File
@@ -66,11 +66,14 @@
@for (url of urls; track url) {
<li>
<strong>ID {{url.id}}</strong> // <strong>URL: </strong>
<a [href]="'https://itz.sh/' + url.short_url" target="_blank">{{ 'https://itz.sh/' + url.short_url }}</a><br>
<a [href]="'https://itz.sh/' + url.short_url" target="_blank" rel="noopener">{{ 'https://itz.sh/' + url.short_url }}</a>
<button type="button" class="copy-btn" (click)="copyShortUrl(url.short_url)" [attr.aria-label]="'Copy ' + ('https://itz.sh/' + url.short_url)" title="Copy Short URL">
<span class="link-icon"><i class="fa-solid fa-link"></i></span>
</button>
<br>
<strong>Original: </strong>
<a [href]="url.og_url" target="_blank">
{{ (url.og_url | slice:0:45) + (url.og_url.length > 40 ? '...' : '')}}
</a><br>
<a [href]="url.og_url" target="_blank">{{ (url.og_url | slice:0:45) + (url.og_url.length > 40 ? '...' : '')}}</a><br>
</li>
}
</ul>
+15
View File
@@ -26,6 +26,8 @@ export class ShortenerComponent implements OnInit, OnDestroy {
short_name: string | null = null;
deleteId: number | null = null;
copiedShort: string | null = null;
constructor(
private shortenerService: ShortenerService,
private authService: AuthService,
@@ -117,4 +119,17 @@ export class ShortenerComponent implements OnInit, OnDestroy {
);
});
}
copyShortUrl(shortCode: string): void {
const shortUrl = `https://itz.sh/${shortCode}`;
navigator.clipboard.writeText(shortUrl).then(() => {
this.copiedShort = shortCode;
setTimeout(() => {
if (this.copiedShort === shortCode) this.copiedShort = null;
}, 2000);
}).catch(() => {
});
}
}