]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/shared/shared-icons/global-icon.component.ts
add check-params test for user list
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-icons / global-icon.component.ts
CommitLineData
28e0e40d 1import { ChangeDetectionStrategy, Component, ElementRef, Input, OnInit } from '@angular/core'
c2023a9f 2import { HooksService } from '@app/core/plugins/hooks.service'
457bb213
C
3
4const icons = {
c41c0e28
RK
5 // misc icons
6 'npm': require('!!raw-loader?!../../../assets/images/misc/npm.svg').default,
7 'language': require('!!raw-loader?!../../../assets/images/misc/language.svg').default,
8 'video-lang': require('!!raw-loader?!../../../assets/images/misc/video-lang.svg').default,
9 'support': require('!!raw-loader?!../../../assets/images/misc/support.svg').default,
10 'robot': require('!!raw-loader?!../../../assets/images/misc/miscellaneous_services.svg').default, // material ui
11 'videos': require('!!raw-loader?!../../../assets/images/misc/video_library.svg').default, // material ui
12 'history': require('!!raw-loader?!../../../assets/images/misc/history.svg').default, // material ui
13 'subscriptions': require('!!raw-loader?!../../../assets/images/misc/subscriptions.svg').default, // material ui
14 'playlist-add': require('!!raw-loader?!../../../assets/images/misc/playlist-add.svg').default, // material ui
ea7337cf
RK
15 'follower': require('!!raw-loader?!../../../assets/images/misc/account-arrow-left.svg').default, // material ui
16 'following': require('!!raw-loader?!../../../assets/images/misc/account-arrow-right.svg').default, // material ui
c41c0e28
RK
17
18 // feather icons
19 'flag': require('!!raw-loader?!../../../assets/images/feather/flag.svg').default,
20 'playlists': require('!!raw-loader?!../../../assets/images/feather/list.svg').default,
21 'syndication': require('!!raw-loader?!../../../assets/images/feather/syndication.svg').default,
22 'help': require('!!raw-loader?!../../../assets/images/feather/help.svg').default,
23 'alert': require('!!raw-loader?!../../../assets/images/feather/alert.svg').default,
24 'globe': require('!!raw-loader?!../../../assets/images/feather/globe.svg').default,
25 'home': require('!!raw-loader?!../../../assets/images/feather/home.svg').default,
26 'recently-added': require('!!raw-loader?!../../../assets/images/feather/recently-added.svg').default,
27 'trending': require('!!raw-loader?!../../../assets/images/feather/trending.svg').default,
28 'search': require('!!raw-loader?!../../../assets/images/feather/search.svg').default,
29 'upload': require('!!raw-loader?!../../../assets/images/feather/upload.svg').default,
30 'dislike': require('!!raw-loader?!../../../assets/images/feather/dislike.svg').default,
31 'like': require('!!raw-loader?!../../../assets/images/feather/like.svg').default,
32 'no': require('!!raw-loader?!../../../assets/images/feather/no.svg').default,
33 'cloud-download': require('!!raw-loader?!../../../assets/images/feather/cloud-download.svg').default,
34 'clock': require('!!raw-loader?!../../../assets/images/feather/clock.svg').default,
35 'cog': require('!!raw-loader?!../../../assets/images/feather/cog.svg').default,
36 'delete': require('!!raw-loader?!../../../assets/images/feather/delete.svg').default,
37 'inbox-full': require('!!raw-loader?!../../../assets/images/feather/inbox-full.svg').default,
38 'sign-out': require('!!raw-loader?!../../../assets/images/feather/log-out.svg').default,
0a4cb95c 39 'sign-in': require('!!raw-loader?!../../../assets/images/feather/log-in.svg').default,
c41c0e28
RK
40 'download': require('!!raw-loader?!../../../assets/images/feather/download.svg').default,
41 'ownership-change': require('!!raw-loader?!../../../assets/images/feather/share.svg').default,
42 'share': require('!!raw-loader?!../../../assets/images/feather/share-2.svg').default,
43 'channel': require('!!raw-loader?!../../../assets/images/feather/tv.svg').default,
44 'user': require('!!raw-loader?!../../../assets/images/feather/user.svg').default,
45 'users': require('!!raw-loader?!../../../assets/images/feather/users.svg').default,
46 'user-add': require('!!raw-loader?!../../../assets/images/feather/user-plus.svg').default,
47 'server': require('!!raw-loader?!../../../assets/images/feather/server.svg').default,
48 'add': require('!!raw-loader?!../../../assets/images/feather/plus-circle.svg').default,
49 'cloud-error': require('!!raw-loader?!../../../assets/images/feather/cloud-off.svg').default,
50 'undo': require('!!raw-loader?!../../../assets/images/feather/corner-up-left.svg').default,
51 'circle-tick': require('!!raw-loader?!../../../assets/images/feather/check-circle.svg').default,
52 'more-horizontal': require('!!raw-loader?!../../../assets/images/feather/more-horizontal.svg').default,
53 'more-vertical': require('!!raw-loader?!../../../assets/images/feather/more-vertical.svg').default,
54 'play': require('!!raw-loader?!../../../assets/images/feather/play.svg').default,
55 'p2p': require('!!raw-loader?!../../../assets/images/feather/airplay.svg').default,
56 'fullscreen': require('!!raw-loader?!../../../assets/images/feather/maximize.svg').default,
57 'exit-fullscreen': require('!!raw-loader?!../../../assets/images/feather/minimize.svg').default,
58 'film': require('!!raw-loader?!../../../assets/images/feather/film.svg').default,
59 'edit': require('!!raw-loader?!../../../assets/images/feather/edit-2.svg').default,
60 'sensitive': require('!!raw-loader?!../../../assets/images/feather/eye.svg').default,
61 'unsensitive': require('!!raw-loader?!../../../assets/images/feather/eye-off.svg').default,
62 'refresh': require('!!raw-loader?!../../../assets/images/feather/refresh-cw.svg').default,
63 'go': require('!!raw-loader?!../../../assets/images/feather/arrow-up-right.svg').default,
64 'cross': require('!!raw-loader?!../../../assets/images/feather/x.svg').default,
65 'tick': require('!!raw-loader?!../../../assets/images/feather/check.svg').default,
66 'repeat': require('!!raw-loader?!../../../assets/images/feather/repeat.svg').default
457bb213
C
67}
68
69export type GlobalIconName = keyof typeof icons
70
71@Component({
72 selector: 'my-global-icon',
73 template: '',
28e0e40d
C
74 styleUrls: [ './global-icon.component.scss' ],
75 changeDetection: ChangeDetectionStrategy.OnPush
457bb213
C
76})
77export class GlobalIconComponent implements OnInit {
78 @Input() iconName: GlobalIconName
79
c2023a9f
C
80 constructor (
81 private el: ElementRef,
82 private hooks: HooksService
83 ) { }
457bb213 84
c2023a9f 85 async ngOnInit () {
7738273b 86 const nativeElement = this.el.nativeElement as HTMLElement
c2023a9f
C
87 nativeElement.innerHTML = await this.hooks.wrapFun(
88 this.getSVGContent.bind(this),
89 { name: this.iconName },
90 'common',
91 'filter:internal.common.svg-icons.get-content.params',
92 'filter:internal.common.svg-icons.get-content.result'
93 )
94 }
95
96 private getSVGContent (options: { name: string }) {
97 return icons[options.name]
457bb213
C
98 }
99}