aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/plugins/shared
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-29 10:41:48 +0100
committerChocobozzz <me@florianbigard.com>2021-12-29 10:41:48 +0100
commit29aedac8dcfc98ff67680d91d6f0f848e86fa4db (patch)
treeea72e501d88f34b566f0ddd231110d5766fcdfeb /client/src/app/+admin/plugins/shared
parent087fc5dadec95061c05bd0b6c86197a32ec4f23c (diff)
downloadPeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.tar.gz
PeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.tar.zst
PeerTube-29aedac8dcfc98ff67680d91d6f0f848e86fa4db.zip
Refactor plugin card
Diffstat (limited to 'client/src/app/+admin/plugins/shared')
-rw-r--r--client/src/app/+admin/plugins/shared/index.ts2
-rw-r--r--client/src/app/+admin/plugins/shared/plugin-card.component.html27
-rw-r--r--client/src/app/+admin/plugins/shared/plugin-card.component.scss (renamed from client/src/app/+admin/plugins/shared/plugin-list.component.scss)5
-rw-r--r--client/src/app/+admin/plugins/shared/plugin-card.component.ts24
4 files changed, 54 insertions, 4 deletions
diff --git a/client/src/app/+admin/plugins/shared/index.ts b/client/src/app/+admin/plugins/shared/index.ts
new file mode 100644
index 000000000..de037c437
--- /dev/null
+++ b/client/src/app/+admin/plugins/shared/index.ts
@@ -0,0 +1,2 @@
1export * from './plugin-api.service'
2export * from './plugin-card.component'
diff --git a/client/src/app/+admin/plugins/shared/plugin-card.component.html b/client/src/app/+admin/plugins/shared/plugin-card.component.html
new file mode 100644
index 000000000..c9fe6201c
--- /dev/null
+++ b/client/src/app/+admin/plugins/shared/plugin-card.component.html
@@ -0,0 +1,27 @@
1<div class="card plugin">
2 <div class="card-body">
3 <div class="first-row">
4 <span class="plugin-name">{{ plugin.name }}</span>
5
6 <span class="plugin-version">{{ version }}</span>
7
8 <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="plugin.homepage" i18n-title title="Plugin homepage (new window)">
9 <my-global-icon iconName="home"></my-global-icon>
10 </a>
11
12 <a class="plugin-icon" target="_blank" rel="noopener noreferrer" [href]="getPluginOrThemeHref(plugin.name)" i18n-title title="Plugin homepage (new window)">
13 <my-global-icon iconName="npm"></my-global-icon>
14 </a>
15
16 <ng-content select="badges"></ng-content>
17
18 <div class="buttons">
19 <ng-content select="buttons"></ng-content>
20 </div>
21 </div>
22
23 <div class="second-row">
24 <div class="description">{{ plugin.description }}</div>
25 </div>
26 </div>
27</div>
diff --git a/client/src/app/+admin/plugins/shared/plugin-list.component.scss b/client/src/app/+admin/plugins/shared/plugin-card.component.scss
index 01c6ee64d..608064722 100644
--- a/client/src/app/+admin/plugins/shared/plugin-list.component.scss
+++ b/client/src/app/+admin/plugins/shared/plugin-card.component.scss
@@ -36,11 +36,8 @@
36 36
37 .buttons { 37 .buttons {
38 @include margin-left(auto); 38 @include margin-left(auto);
39 width: max-content;
40 39
41 > *:not(:last-child) { 40 width: max-content;
42 @include margin-right(10px);
43 }
44 } 41 }
45} 42}
46 43
diff --git a/client/src/app/+admin/plugins/shared/plugin-card.component.ts b/client/src/app/+admin/plugins/shared/plugin-card.component.ts
new file mode 100644
index 000000000..462a6c213
--- /dev/null
+++ b/client/src/app/+admin/plugins/shared/plugin-card.component.ts
@@ -0,0 +1,24 @@
1import { Component, Input } from '@angular/core'
2import { PeerTubePlugin, PeerTubePluginIndex, PluginType } from '@shared/models'
3import { PluginApiService } from './plugin-api.service'
4
5@Component({
6 selector: 'my-plugin-card',
7 templateUrl: './plugin-card.component.html',
8 styleUrls: [ './plugin-card.component.scss' ]
9})
10
11export class PluginCardComponent {
12 @Input() plugin: PeerTubePluginIndex | PeerTubePlugin
13 @Input() version: string
14 @Input() pluginType: PluginType
15
16 constructor (
17 private pluginApiService: PluginApiService
18 ) {
19 }
20
21 getPluginOrThemeHref (name: string) {
22 return this.pluginApiService.getPluginOrThemeHref(this.pluginType, name)
23 }
24}