Skip to content
Commits on Source (2)
......@@ -4,7 +4,7 @@ services:
- docker:dind
stages:
- test:unit
- test
- build
- prepare
- review
......@@ -21,11 +21,19 @@ variables:
test:
image: circleci/node:8-browsers
stage: test:unit
stage: test
script:
- npm ci
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
lint:
stage: test
script:
- npm i -g prettier
- prettier --check "src/**/*.ts"
- prettier --check "src/**/*.scss"
- prettier --check "src/**/*.html"
e2e:chrome:
image: cypress/browsers:chrome67
stage: test:e2e
......
# .prettierrc
# Use this file to define your defaults for prettier
# For a list of all available options:
# https://prettier.io/docs/en/options.html
trailingComma: 'es5'
printWidth: 80
singleQuote: true
semi: true
......@@ -14658,6 +14658,12 @@
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
"integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
},
"prettier": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==",
"dev": true
},
"pretty-hrtime": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz",
......
import { trigger, style, animate, transition, keyframes } from '@angular/animations';
import {
trigger,
style,
animate,
transition,
keyframes,
} from '@angular/animations';
export const animations: any[] = [
trigger('foolishIn', [
transition('* => *', [
style({ opacity: 0 }),
animate(2000, keyframes([
style({ opacity: 0, transformOrigin: '50% 50%', transform: 'scale(0, 0) rotate(360deg)', offset: 0.000 }),
style({ opacity: 1, transformOrigin: '0% 100%', transform: 'scale(0.5, 0.5) rotate(0deg)', offset: 0.066 }),
style({ opacity: 1, transformOrigin: '100% 100%', transform: 'scale(0.5, 0.5) rotate(0deg)', offset: 0.132 }),
style({ opacity: 1, transformOrigin: '0%', transform: 'scale(0.5, 0.5) rotate(0deg)', offset: 0.198 }),
style({ opacity: 1, transformOrigin: '0% 0%', transform: 'scale(0.5, 0.5) rotate(0deg)', offset: 0.264 }),
style({ opacity: 1, transformOrigin: '50% 50%', transform: 'scale(1, 1) rotate(0deg)', offset: 0.330 }),
style({ opacity: 1, offset: 0.660 }),
style({ opacity: 0, offset: 1.000 }),
]))
])
])
animate(
2000,
keyframes([
style({
opacity: 0,
transformOrigin: '50% 50%',
transform: 'scale(0, 0) rotate(360deg)',
offset: 0.0,
}),
style({
opacity: 1,
transformOrigin: '0% 100%',
transform: 'scale(0.5, 0.5) rotate(0deg)',
offset: 0.066,
}),
style({
opacity: 1,
transformOrigin: '100% 100%',
transform: 'scale(0.5, 0.5) rotate(0deg)',
offset: 0.132,
}),
style({
opacity: 1,
transformOrigin: '0%',
transform: 'scale(0.5, 0.5) rotate(0deg)',
offset: 0.198,
}),
style({
opacity: 1,
transformOrigin: '0% 0%',
transform: 'scale(0.5, 0.5) rotate(0deg)',
offset: 0.264,
}),
style({
opacity: 1,
transformOrigin: '50% 50%',
transform: 'scale(1, 1) rotate(0deg)',
offset: 0.33,
}),
style({ opacity: 1, offset: 0.66 }),
style({ opacity: 0, offset: 1.0 }),
])
),
]),
]),
];
......@@ -4,7 +4,9 @@
</ng-container>
<ng-container icons>
<m-notifications--topbar-toggle *ngIf="session.isLoggedIn()"></m-notifications--topbar-toggle>
<m-notifications--topbar-toggle
*ngIf="session.isLoggedIn()"
></m-notifications--topbar-toggle>
</ng-container>
</m-v2-topbar>
<ng-template #legacyTopbar>
......@@ -20,15 +22,18 @@
</m-topbar>
</ng-template>
<m-sidebar--markers [class.has-v2-navbar]="featuresService.has('top-feeds')"></m-sidebar--markers>
<m-sidebar--markers
[class.has-v2-navbar]="featuresService.has('top-feeds')"
></m-sidebar--markers>
<m-body [class.has-v2-navbar]="featuresService.has('top-feeds')">
<m-announcement [id]="'blockchain:sale'" *ngIf="false">
<span class="m-blockchain--wallet-address-notice--action"
<span
class="m-blockchain--wallet-address-notice--action"
routerLink="/tokens"
i18n="@@BLOCKCHAIN__SALE__NOTICE"
>
The MINDS token is now live. Learn more here.
The MINDS token is now live. Learn more here.
</span>
</m-announcement>
<m-blockchain--wallet-address-notice></m-blockchain--wallet-address-notice>
......@@ -42,11 +47,12 @@
<m-overlay-modal></m-overlay-modal>
<m--blockchain--transaction-overlay></m--blockchain--transaction-overlay>
<m-modal--tos-updated *ngIf="session.isLoggedIn()"></m-modal--tos-updated>
<m-juryDutySession__summons *ngIf="session.isLoggedIn()"></m-juryDutySession__summons>
<m-juryDutySession__summons
*ngIf="session.isLoggedIn()"
></m-juryDutySession__summons>
<m-modal-signup-on-scroll></m-modal-signup-on-scroll>
<m-channel--onboarding *ngIf="showOnboarding"></m-channel--onboarding>
<m-cookies-notice *ngIf="!session.isLoggedIn()">
</m-cookies-notice>
<m-cookies-notice *ngIf="!session.isLoggedIn()"> </m-cookies-notice>
@import "defaults";
@import "themes";
@import 'defaults';
@import 'themes';
html, body {
html,
body {
font-family: 'Roboto', Helvetica, sans-serif !important;
}
m-app {
//width: 100%;
//min-width: $min-mobile;
//height: 100%;
......@@ -15,8 +15,8 @@ m-app {
//overflow: visible;
//position: relative;
.initial-loading{
width:100%;
.initial-loading {
width: 100%;
}
.m-initial-loading-centred {
......@@ -24,20 +24,20 @@ m-app {
}
m-body {
@include m-theme(){
@include m-theme() {
background-color: themed($m-body-bg);
}
// display: inline-block;
// overflow:visible;
// flex-grow: 1;
// z-index: 1;
// margin-top: $layout-header-height;
// margin-left: $layout-sidebar-width;
// width: 100%;
//
// @media screen and (max-width: $min-tablet){
// margin-left:0;
// }
// display: inline-block;
// overflow:visible;
// flex-grow: 1;
// z-index: 1;
// margin-top: $layout-header-height;
// margin-left: $layout-sidebar-width;
// width: 100%;
//
// @media screen and (max-width: $min-tablet){
// margin-left:0;
// }
}
p {
......@@ -51,12 +51,11 @@ m-app {
font-size: 20px;
line-height: 20px;
overflow: visible;
@include m-theme(){
@include m-theme() {
color: rgba(themed($m-black), 0.75);
}
}
.mdl-card__supporting-text{
.mdl-card__supporting-text {
font-family: 'Roboto', Helvetica, sans-serif;
}
}
......@@ -68,10 +67,12 @@ m-app {
flex-direction: column;
width: 100%;
height: 100%;
.m-page--main, .m-page__main {
.m-page--main,
.m-page__main {
overflow: visible !important;
}
.m-page--sidebar, .m-page__sidebar {
.m-page--sidebar,
.m-page__sidebar {
width: initial !important;
min-width: 300px;
padding: 16px !important;
......@@ -84,13 +85,15 @@ m-app {
margin: auto;
}
.m-page--main, .m-page__main {
.m-page--main,
.m-page__main {
padding: 16px;
flex: 1;
overflow: auto;
}
.m-page--sidebar, .m-page__sidebar {
.m-page--sidebar,
.m-page__sidebar {
padding: 16px 0 16px 16px;
width: 300px;
}
......@@ -106,18 +109,19 @@ m-app {
text-decoration: none;
font-size: 13px;
@include m-theme(){
@include m-theme() {
background-color: themed($m-white);
border: 1px solid themed($m-grey-50);
}
&.m-page--sidebar--navigation--item-active {
@include m-theme(){
@include m-theme() {
color: themed($m-blue);
}
}
i, span {
i,
span {
vertical-align: middle;
}
......@@ -127,7 +131,7 @@ m-app {
}
}
.m-loader {
width: 100% ;
width: 100%;
padding: 16px;
text-align: center;
}
......@@ -11,11 +11,11 @@ import { BlockchainService } from './modules/blockchain/blockchain.service';
import { Web3WalletService } from './modules/blockchain/web3-wallet.service';
import { Client } from './services/api/client';
import { WebtorrentService } from './modules/webtorrent/webtorrent.service';
import { ActivatedRoute, Router } from "@angular/router";
import { ChannelOnboardingService } from "./modules/onboarding/channel/onboarding.service";
import { BlockListService } from "./common/services/block-list.service";
import { FeaturesService } from "./services/features.service";
import { ThemeService } from "./common/services/theme.service";
import { ActivatedRoute, Router } from '@angular/router';
import { ChannelOnboardingService } from './modules/onboarding/channel/onboarding.service';
import { BlockListService } from './common/services/block-list.service';
import { FeaturesService } from './services/features.service';
import { ThemeService } from './common/services/theme.service';
import { BannedService } from './modules/report/banned/banned.service';
@Component({
......@@ -50,7 +50,7 @@ export class Minds {
public blockListService: BlockListService,
public featuresService: FeaturesService,
public themeService: ThemeService,
private bannedService: BannedService,
private bannedService: BannedService
) {
this.name = 'Minds';
}
......@@ -58,11 +58,15 @@ export class Minds {
async ngOnInit() {
this.notificationService.getNotifications();
this.session.isLoggedIn(async (is) => {
this.session.isLoggedIn(async is => {
if (is) {
this.showOnboarding = await this.onboardingService.showModal();
if (this.minds.user.language !== this.minds.language) {
console.log('[app]:: language change', this.minds.user.language, this.minds.language);
console.log(
'[app]:: language change',
this.minds.user.language,
this.minds.language
);
window.location.reload(true);
}
}
......@@ -93,7 +97,7 @@ export class Minds {
this.web3Wallet.setUp();
this.webtorrent.setUp();
this.themeService.setUp();
}
......
import { CUSTOM_ELEMENTS_SCHEMA, NgModule, Injectable, ErrorHandler } from '@angular/core';
import {
CUSTOM_ELEMENTS_SCHEMA,
NgModule,
Injectable,
ErrorHandler,
} from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
......@@ -8,7 +13,11 @@ import { environment } from '../environments/environment';
import { Minds } from './app.component';
import { MINDS_APP_ROUTING_DECLARATIONS, MindsAppRoutes, MindsAppRoutingProviders } from './router/app';
import {
MINDS_APP_ROUTING_DECLARATIONS,
MindsAppRoutes,
MindsAppRoutingProviders,
} from './router/app';
import { MINDS_DECLARATIONS } from './declarations';
import { MINDS_PLUGIN_DECLARATIONS } from './plugin-declarations';
......@@ -57,13 +66,13 @@ import { HelpdeskModule } from './modules/helpdesk/helpdesk.module';
import { MobileModule } from './modules/mobile/mobile.module';
import { IssuesModule } from './modules/issues/issues.module';
import { CanaryModule } from './modules/canary/canary.module';
import { HttpClientModule } from "@angular/common/http";
import { AnalyticsModule } from "./modules/analytics/analytics.module";
import { HttpClientModule } from '@angular/common/http';
import { AnalyticsModule } from './modules/analytics/analytics.module';
import * as Sentry from "@sentry/browser";
import * as Sentry from '@sentry/browser';
Sentry.init({
dsn: "https://3f786f8407e042db9053434a3ab527a2@sentry.io/1538008", // TODO: do not hardcard
dsn: 'https://3f786f8407e042db9053434a3ab527a2@sentry.io/1538008', // TODO: do not hardcard
release: environment.version,
environment: (<any>window.Minds).environment || 'development',
});
......@@ -78,9 +87,7 @@ export class SentryErrorHandler implements ErrorHandler {
}
@NgModule({
bootstrap: [
Minds
],
bootstrap: [Minds],
declarations: [
Minds,
MINDS_APP_ROUTING_DECLARATIONS,
......@@ -93,7 +100,7 @@ export class SentryErrorHandler implements ErrorHandler {
ReactiveFormsModule,
FormsModule,
HttpClientModule,
RouterModule.forRoot(MindsAppRoutes, { onSameUrlNavigation: "reload" }),
RouterModule.forRoot(MindsAppRoutes, { onSameUrlNavigation: 'reload' }),
CaptchaModule,
CommonModule,
AnalyticsModule,
......@@ -145,9 +152,6 @@ export class SentryErrorHandler implements ErrorHandler {
MINDS_PROVIDERS,
MINDS_PLUGIN_PROVIDERS,
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class MindsModule {
}
export class MindsModule {}
import { Cookie } from '../../services/cookie';
import { HttpClient, HttpHeaders } from "@angular/common/http";
import { HttpClient, HttpHeaders } from '@angular/common/http';
/**
* API Class
*/
export class MindsHttpClient {
base: string = '/';
cookie: Cookie = new Cookie();
......@@ -13,18 +12,14 @@ export class MindsHttpClient {
return new MindsHttpClient(http);
}
constructor(public http: HttpClient) {
}
constructor(public http: HttpClient) {}
/**
* Return a GET request
*/
get(endpoint: string, data: Object = {}, options: Object = {}) {
endpoint += '?' + this.buildParams(data);
return this.http.get(
this.base + endpoint,
this.buildOptions(options)
);
return this.http.get(this.base + endpoint, this.buildOptions(options));
// .map(response => response.json());
}
......@@ -54,16 +49,15 @@ export class MindsHttpClient {
* Return a DELETE request
*/
delete(endpoint: string, data: Object = {}, options: Object = {}) {
return this.http.delete(
this.base + endpoint,
this.buildOptions(options)
);
return this.http.delete(this.base + endpoint, this.buildOptions(options));
}
private buildParams(object: Object) {
return Object.keys(object).map((k) => {
return encodeURIComponent(k) + '=' + encodeURIComponent(object[k]);
}).join('&');
return Object.keys(object)
.map(k => {
return encodeURIComponent(k) + '=' + encodeURIComponent(object[k]);
})
.join('&');
}
/**
......@@ -78,11 +72,9 @@ export class MindsHttpClient {
return Object.assign(options, {
headers: headers,
cache: true
cache: true,
});
}
}
export { Client } from '../../services/api/client';
......@@ -56,7 +56,7 @@ import { ChartComponent } from './components/chart/chart.component';
import { DateSelectorComponent } from './components/date-selector/date-selector.component';
import { AdminActionsButtonComponent } from './components/button/admin-actions/admin-actions.component';
import { InlineEditorComponent } from './components/editors/inline-editor.component';
import { AttachmentService } from "../services/attachment";
import { AttachmentService } from '../services/attachment';
import { MaterialBoundSwitchComponent } from './components/material/bound-switch.component';
import { IfFeatureDirective } from './directives/if-feature.directive';
import { MindsEmoji } from './components/emoji/emoji';
......@@ -81,35 +81,30 @@ import { PieGraph } from './components/graphs/pie-graph';
import { GraphSVG } from './components/graphs/svg';
import { GraphPoints } from './components/graphs/points';
import { DynamicFormComponent } from './components/forms/dynamic-form/dynamic-form.component';
import { SortSelectorComponent } from "./components/sort-selector/sort-selector.component";
import { SortSelectorComponent } from './components/sort-selector/sort-selector.component';
import { UpdateMarkersService } from './services/update-markers.service';
import { SocketsService } from '../services/sockets';
import { Storage } from '../services/storage';
import { HttpClient } from "@angular/common/http";
import { AndroidAppDownloadComponent } from "./components/android-app-download-button/button.component";
import { SwitchComponent } from "./components/switch/switch.component";
import { V2TopbarComponent } from "./layout/v2-topbar/v2-topbar.component";
import { UserMenuComponent } from "./layout/v2-topbar/user-menu.component";
import { FeaturedContentComponent } from "./components/featured-content/featured-content.component";
import { FeaturedContentService } from "./components/featured-content/featured-content.service";
import { BoostedContentService } from "./services/boosted-content.service";
import { HttpClient } from '@angular/common/http';
import { AndroidAppDownloadComponent } from './components/android-app-download-button/button.component';
import { SwitchComponent } from './components/switch/switch.component';
import { V2TopbarComponent } from './layout/v2-topbar/v2-topbar.component';
import { UserMenuComponent } from './layout/v2-topbar/user-menu.component';
import { FeaturedContentComponent } from './components/featured-content/featured-content.component';
import { FeaturedContentService } from './components/featured-content/featured-content.service';
import { BoostedContentService } from './services/boosted-content.service';
import { FeedsService } from './services/feeds.service';
import { EntitiesService } from "./services/entities.service";
import { BlockListService } from "./services/block-list.service";
import { SettingsService } from "../modules/settings/settings.service";
import { ThemeService } from "./services/theme.service";
import { HorizontalInfiniteScroll } from "./components/infinite-scroll/horizontal-infinite-scroll.component";
import { EntitiesService } from './services/entities.service';
import { BlockListService } from './services/block-list.service';
import { SettingsService } from '../modules/settings/settings.service';
import { ThemeService } from './services/theme.service';
import { HorizontalInfiniteScroll } from './components/infinite-scroll/horizontal-infinite-scroll.component';
import { ReferralsLinksComponent } from '../modules/wallet/tokens/referrals/links/links.component';
import { ShareModalComponent } from '../modules/modals/share/share';
@NgModule({
imports: [
NgCommonModule,
RouterModule,
FormsModule,
ReactiveFormsModule,
],
imports: [NgCommonModule, RouterModule, FormsModule, ReactiveFormsModule],
declarations: [
MINDS_PIPES,
......@@ -283,44 +278,65 @@ import { ShareModalComponent } from '../modules/modals/share/share';
{
provide: AttachmentService,
useFactory: AttachmentService._,
deps: [Session, Client, Upload, HttpClient ]
deps: [Session, Client, Upload, HttpClient],
},
{
provide: UpdateMarkersService,
useFactory: (_http, _session, _sockets) => { return new UpdateMarkersService(_http, _session, _sockets); },
deps: [ MindsHttpClient, Session, SocketsService ],
useFactory: (_http, _session, _sockets) => {
return new UpdateMarkersService(_http, _session, _sockets);
},
deps: [MindsHttpClient, Session, SocketsService],
},
{
provide: MindsHttpClient,
useFactory: MindsHttpClient._,
deps: [HttpClient]
deps: [HttpClient],
},
{
provide: NSFWSelectorCreatorService,
useFactory: (_storage) => new NSFWSelectorCreatorService(_storage),
deps: [ Storage ],
useFactory: _storage => new NSFWSelectorCreatorService(_storage),
deps: [Storage],
},
{
provide: NSFWSelectorConsumerService,
useFactory: (_storage) => new NSFWSelectorConsumerService(_storage),
deps: [ Storage ],
useFactory: _storage => new NSFWSelectorConsumerService(_storage),
deps: [Storage],
},
{
provide: BoostedContentService,
useFactory: (client, session, entitiesService, blockListService, settingsService) => new BoostedContentService(client, session, entitiesService, blockListService, settingsService),
deps: [ Client, Session, EntitiesService, BlockListService, SettingsService ]
useFactory: (
client,
session,
entitiesService,
blockListService,
settingsService
) =>
new BoostedContentService(
client,
session,
entitiesService,
blockListService,
settingsService
),
deps: [
Client,
Session,
EntitiesService,
BlockListService,
SettingsService,
],
},
{
provide: FeaturedContentService,
useFactory: boostedContentService => new FeaturedContentService(boostedContentService),
deps: [ FeedsService ],
}
useFactory: boostedContentService =>
new FeaturedContentService(boostedContentService),
deps: [FeedsService],
},
],
entryComponents: [
NotificationsToasterComponent,
ReferralsLinksComponent,
ShareModalComponent,
]
],
})
export class CommonModule {}
......@@ -9,24 +9,24 @@ import { Client } from '../../../services/api';
<minds-graph-line [data]="data"></minds-graph-line>
<div class="graph-labels">
<div class="graph-label mdl-color-text--blue-grey-300" *ngFor="let point of data">
{{point.total}}
<b>{{point.timestamp * 1000 | date: 'MMMd'}}</b>
<div
class="graph-label mdl-color-text--blue-grey-300"
*ngFor="let point of data"
>
{{ point.total }}
<b>{{ point.timestamp * 1000 | date: 'MMMd' }}</b>
</div>
</div>
`,
})
export class AnalyticsImpressions {
key;
span: number = 5;
unit: string = 'day';
data: Array<any> = [];
constructor(public client: Client) {
}
constructor(public client: Client) {}
set _key(value: any) {
this.key = value;
......@@ -35,13 +35,13 @@ export class AnalyticsImpressions {
get() {
var self = this;
this.client.get('api/v1/analytics/' + this.key, {
span: this.span,
unit: this.unit
})
this.client
.get('api/v1/analytics/' + this.key, {
span: this.span,
unit: this.unit,
})
.then((response: any) => {
self.data = response.data;
});
}
}
.m-androidApp__download {
box-sizing: border-box;
border-radius: 8px;
@include m-theme(){
@include m-theme() {
border: 1px solid rgba(themed($m-white-always), 0.7);
background: themed($m-black-always);
}
......@@ -33,13 +33,13 @@
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
@include m-theme(){
@include m-theme() {
color: themed($m-white-always);
}
}
i.material-icons {
@include m-theme(){
@include m-theme() {
color: themed($m-white-always);
}
}
......
import { Component } from '@angular/core';
import { Router } from "@angular/router";
import { Router } from '@angular/router';
@Component({
selector: 'm-androidApp__download',
......@@ -10,14 +10,10 @@ import { Router } from "@angular/router";
Android App
</h2>
</a>
`
`,
})
export class AndroidAppDownloadComponent {
minds = window.Minds;
constructor(private router: Router) {
}
constructor(private router: Router) {}
}
@import "defaults";
@import 'defaults';
$m-announcment-height: 50px;
m-announcement{
m-announcement {
display: block;
position: relative;
width: 100%;
min-height: $m-announcment-height;
height: $m-announcment-height;
.m-announcement{
position:fixed;
.m-announcement {
position: fixed;
width: 100%;
height: $m-announcment-height;
z-index: 9999;
display:flex;
display: flex;
flex-direction: row;
align-items:center;
align-items: center;
@include m-theme(){
@include m-theme() {
background-color: themed($m-blue);
}
@media screen and (max-width: 770px){
width: 100%;
@media screen and (max-width: 770px) {
width: 100%;
}
}
.m-announcement--content{
.m-announcement--content {
text-align: center;
letter-spacing: 1.2px;
font-weight: 300;
......@@ -38,33 +36,33 @@ m-announcement{
text-rendering: optimizeLegibility;
font-size: 16px;
flex: 1;
@include m-theme(){
@include m-theme() {
color: themed($m-white);
}
@media screen and (max-width:770px){
font-size:10px;
padding-right: 50px;
@media screen and (max-width: 770px) {
font-size: 10px;
padding-right: 50px;
}
a {
text-decoration:none;
@include m-theme(){
text-decoration: none;
@include m-theme() {
color: themed($m-white);
}
display:block;
display: block;
font-weight: 300;
}
}
.m-announcement--close{
cursor:pointer;
padding:12px;
position:absolute;
.m-announcement--close {
cursor: pointer;
padding: 12px;
position: absolute;
right: 0;
i {
@include m-theme(){
@include m-theme() {
color: themed($m-white);
}
}
......
......@@ -6,12 +6,10 @@ import { Client } from '../../../services/api';
@Component({
selector: 'm-announcement',
host: {
'[hidden]': 'hidden'
'[hidden]': 'hidden',
},
template: `
<div class="m-announcement">
<div class="m-announcement--content">
<ng-content></ng-content>
</div>
......@@ -19,28 +17,22 @@ import { Client } from '../../../services/api';
<div class="m-announcement--close" (click)="close()">
<i class="material-icons">close</i>
</div>
</div>
`
`,
})
export class AnnouncementComponent {
minds: Minds = window.Minds;
hidden: boolean = false;
@Input() id: string = 'default';
constructor(private storage: Storage) {
}
constructor(private storage: Storage) {}
ngOnInit() {
if (this.storage.get('hide-announcement:' + this.id))
this.hidden = true;
if (this.storage.get('hide-announcement:' + this.id)) this.hidden = true;
}
close() {
this.storage.set('hide-announcement:' + this.id, true);
this.hidden = true;
}
}
export * from './text-input-autocomplete.module';
export {
TextInputAutocompleteMenuComponent
TextInputAutocompleteMenuComponent,
} from './text-input-autocomplete-menu.component';
<ng-container *ngIf="choice?.type == 'user'; else hashtagBlock">
<a
href="javascript:;"
(click)="selectChoice.next(choice)"
>
<img
class="m-postAutocompleteItemRenderer__avatar mdl-shadow--2dp"
[src]="minds.cdn_url + 'icon/' + choice.guid + '/medium/' + choice.icontime">
{{ choice.username }}
</a>
<a href="javascript:;" (click)="selectChoice.next(choice)">
<img
class="m-postAutocompleteItemRenderer__avatar mdl-shadow--2dp"
[src]="
minds.cdn_url + 'icon/' + choice.guid + '/medium/' + choice.icontime
"
/>
{{ choice.username }}
</a>
</ng-container>
<ng-template #hashtagBlock>
<a
href="javascript:;"
(click)="selectChoice.next(choice)"
>
#{{ choice }}
</a>
<a href="javascript:;" (click)="selectChoice.next(choice)"> #{{ choice }} </a>
</ng-template>
......@@ -2,9 +2,8 @@ import { Component, Input, OnInit } from '@angular/core';
@Component({
selector: 'm-post-autocomplete-item-renderer',
templateUrl: 'posts-autocomplete.component.html'
templateUrl: 'posts-autocomplete.component.html',
})
export class PostsAutocompleteItemRendererComponent {
@Input() choice;
@Input() selectChoice;
......
......@@ -4,13 +4,12 @@ import { Component } from '@angular/core';
selector: 'm-text-input--autocomplete-container',
styles: [
`
:host {
position: relative;
display: block;
}
`
:host {
position: relative;
display: block;
}
`,
],
template: '<ng-content></ng-content>'
template: '<ng-content></ng-content>',
})
export class TextInputAutocompleteContainerComponent {
}
export class TextInputAutocompleteContainerComponent {}