diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-29 10:41:48 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-29 10:41:48 +0100 |
commit | 29aedac8dcfc98ff67680d91d6f0f848e86fa4db (patch) | |
tree | ea72e501d88f34b566f0ddd231110d5766fcdfeb /client/src/app/+admin/plugins/shared | |
parent | 087fc5dadec95061c05bd0b6c86197a32ec4f23c (diff) | |
download | PeerTube-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.ts | 2 | ||||
-rw-r--r-- | client/src/app/+admin/plugins/shared/plugin-card.component.html | 27 | ||||
-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.ts | 24 |
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 @@ | |||
1 | export * from './plugin-api.service' | ||
2 | export * 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 @@ | |||
1 | import { Component, Input } from '@angular/core' | ||
2 | import { PeerTubePlugin, PeerTubePluginIndex, PluginType } from '@shared/models' | ||
3 | import { 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 | |||
11 | export 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 | } | ||