From f948e2b082e7d2203257b6e422c8827398266044 Mon Sep 17 00:00:00 2001 From: itzMiney Date: Sun, 15 Feb 2026 10:08:22 +0100 Subject: [PATCH] Updated Shortener Admin Page --- package-lock.json | 21 +++++++++++++++++++++ src/app/shortener/shortener.component.css | 15 +++++++++++++++ src/app/shortener/shortener.component.html | 11 +++++++---- src/app/shortener/shortener.component.ts | 15 +++++++++++++++ 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 389fee3..5757927 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/src/app/shortener/shortener.component.css b/src/app/shortener/shortener.component.css index 4fc7e55..c0460d2 100644 --- a/src/app/shortener/shortener.component.css +++ b/src/app/shortener/shortener.component.css @@ -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; +} diff --git a/src/app/shortener/shortener.component.html b/src/app/shortener/shortener.component.html index 68561c5..8a454aa 100644 --- a/src/app/shortener/shortener.component.html +++ b/src/app/shortener/shortener.component.html @@ -66,11 +66,14 @@ @for (url of urls; track url) {
  • ID {{url.id}} // URL: - {{ 'https://itz.sh/' + url.short_url }}
    + {{ 'https://itz.sh/' + url.short_url }} + + +
    Original: - - {{ (url.og_url | slice:0:45) + (url.og_url.length > 40 ? '...' : '')}} -
    + {{ (url.og_url | slice:0:45) + (url.og_url.length > 40 ? '...' : '')}}
  • } diff --git a/src/app/shortener/shortener.component.ts b/src/app/shortener/shortener.component.ts index e666873..1d66a93 100644 --- a/src/app/shortener/shortener.component.ts +++ b/src/app/shortener/shortener.component.ts @@ -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(() => { + }); + } }