Updated Shortener Admin Page
This commit is contained in:
1 parent
6fec6ce1c7
commit
f948e2b082
4 files changed
+58
-4
No files matched your search
@@ -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;
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -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(() => {
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user