Skip to content
Commits on Source (20)
......@@ -26,7 +26,6 @@
"scripts": [
"../node_modules/material-design-lite/dist/material.min.js",
"../node_modules/medium-editor/dist/js/medium-editor.min.js",
"shims/fontawesome.js",
"shims/jitsi-api.min.js"
],
"environmentSource": "environments/environment.ts",
......
......@@ -4,7 +4,7 @@ services:
- docker:dind
stages:
- test:unit
- test
- build
- prepare
- review
......@@ -12,6 +12,7 @@ stages:
- test:e2e
- deploy:canary
- deploy:production
- cleanup
variables:
CYPRESS_INSTALL_BINARY: 0 # Speeds up the install process
......@@ -20,37 +21,18 @@ variables:
test:
image: circleci/node:8-browsers
stage: test:unit
stage: test
script:
- npm ci
- npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
e2e:base:
image: cypress/base:10
stage: test:e2e
variables:
CYPRESS_INSTALL_BINARY: 3.4.1
lint:
stage: test
script:
- npm ci
- >
if [ "$CI_BUILD_REF_NAME" == "master" ]; then
export E2E_DOMAIN=https://www.minds.com
else
export E2E_DOMAIN=https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
fi
- export CYPRESS_baseUrl=$E2E_DOMAIN
- echo "E2E tests for $CI_BUILD_REF_NAME running against $E2E_DOMAIN with user $CYPRESS_username"
- $(npm bin)/cypress run --record --key $CYPRESS_RECORD_ID --config CYPRESS_baseUrl=$E2E_DOMAIN
artifacts:
when: always
paths:
- cypress/screenshots
- cypress/videos
cache:
paths:
- .npm
- cache/Cypress
allow_failure: true #manual inspection in case of timeouts
- npm i -g prettier
- prettier --check "src/**/*.ts"
- prettier --check "src/**/*.scss"
- prettier --check "src/**/*.html"
e2e:chrome:
image: cypress/browsers:chrome67
......@@ -79,10 +61,14 @@ e2e:chrome:
- cache/Cypress
allow_failure: true #manual inspection in case of timeouts
###############
# Build Stage #
###############
build:review:
stage: build
before_script:
- sed -ri "s|\"VERSION\"|\"$CI_COMMIT_SHA\"|" src/environments/environment.prod.ts
- sed -ri "s|\"VERSION\"|\"$CI_PIPELINE_ID\"|" src/environments/environment.prod.ts
script:
- npm ci && npm install -g gulp-cli
- npm run postinstall
......@@ -100,7 +86,7 @@ build:review:
build:production:en:
stage: build
before_script:
- sed -ri "s|\"VERSION\"|\"$CI_COMMIT_SHA\"|" src/environments/environment.prod.ts
- sed -ri "s|\"VERSION\"|\"$CI_PIPELINE_ID\"|" src/environments/environment.prod.ts
script:
- npm ci && npm install -g gulp-cli
- npm run postinstall
......@@ -118,7 +104,7 @@ build:production:en:
build:production:i18n:
stage: build
before_script:
- sed -ri "s|\"VERSION\"|\"$CI_COMMIT_SHA\"|" src/environments/environment.prod.ts
- sed -ri "s|\"VERSION\"|\"$CI_PIPELINE_ID\"|" src/environments/environment.prod.ts
script:
- npm ci && npm install -g gulp-cli
- npm run postinstall
......@@ -133,24 +119,28 @@ build:production:i18n:
- master
- test/gitlab-ci
#################
# Prepare Stage #
#################
.sentry_prepare: &sentry_prepare
stage: prepare
image: getsentry/sentry-cli
script:
- echo "Create a new release $CI_COMMIT_SHA"
- sentry-cli releases new $CI_COMMIT_SHA
- sentry-cli releases set-commits --auto $CI_COMMIT_SHA
- sentry-cli releases files $CI_COMMIT_SHA upload-sourcemaps $CI_PROJECT_DIR/dist/en -x .js -x .map --validate --url-prefix $SOURCEMAP_PREFIX
- sentry-cli releases finalize $CI_COMMIT_SHA
- echo "Finalized release for $CI_COMMIT_SHA"
- echo "Create a new release $CI_PIPELINE_ID"
- sentry-cli releases new $CI_PIPELINE_ID
- sentry-cli releases set-commits --auto $CI_PIPELINE_ID
- sentry-cli releases files $CI_PIPELINE_ID upload-sourcemaps $CI_PROJECT_DIR/dist/en -x .js -x .map --validate --url-prefix $SOURCEMAP_PREFIX
- sentry-cli releases finalize $CI_PIPELINE_ID
- echo "Finalized release for $CI_PIPELINE_ID"
prepare:review:
stage: prepare
image: minds/ci:latest
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF -f containers/front-init/Dockerfile dist/.
- docker push $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
- docker build -t $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID -f containers/front-init/Dockerfile dist/.
- docker push $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID
dependencies:
- build:review
except:
......@@ -159,7 +149,7 @@ prepare:review:
- test/gitlab-ci
prepare:review:sentry:
<<: *sentry_prepare
<<: *sentry_prepare
variables:
SOURCEMAP_PREFIX: "~/en"
except:
......@@ -174,8 +164,8 @@ prepare:production:
image: minds/ci:latest
script:
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker build -t $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF -f containers/front-init/Dockerfile dist/.
- docker push $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
- docker build -t $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID -f containers/front-init/Dockerfile dist/.
- docker push $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID
only:
refs:
- master
......@@ -196,6 +186,26 @@ prepare:production:sentry:
- build:production:en
- build:production:i18n
################
# Review Stage #
################
.cleanup_review: &cleanup_review
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- helm del --purge $CI_BUILD_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
action: stop
variables:
GIT_STRATEGY: none
except:
refs:
- master
- test/gitlab-ci
review:start:
stage: review
image: minds/helm-eks:latest
......@@ -206,14 +216,14 @@ review:start:
--install \
--reuse-values \
--set frontInit.image.repository=$CI_REGISTRY_IMAGE/front-init \
--set frontInit.image.tag=$CI_BUILD_REF \
--set-string frontInit.image.tag=$CI_PIPELINE_ID \
--set domain=$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN \
--set elasticsearch.clusterName=$CI_BUILD_REF_SLUG--elasticsearch \
--wait \
$CI_BUILD_REF_SLUG \
./helm-charts/minds"
# Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e review-$CI_COMMIT_REF_SLUG
- sentry-cli releases deploys $CI_PIPELINE_ID new -e review-$CI_COMMIT_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
......@@ -224,75 +234,53 @@ review:start:
- test/gitlab-ci
review:stop:
<<: *cleanup_review
stage: review
image: minds/helm-eks:latest
script:
- aws eks update-kubeconfig --name=sandbox
- helm del --purge $CI_BUILD_REF_SLUG
environment:
name: review/$CI_COMMIT_REF_NAME
url: https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
action: stop
variables:
GIT_STRATEGY: none
when: manual
except:
refs:
- master
- test/gitlab-ci
staging:fpm:
stage: deploy:staging
################
# Deploy Stage #
################
.deploy: &deploy
image: minds/ci:latest
script:
- IMAGE_LABEL="staging"
## Sync assets with CDN
- aws s3 sync dist $S3_REPOSITORY_URL
- $(aws ecr get-login --no-include-email --region us-east-1)
## Update docker front-init container
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
- docker tag $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF $ECR_REPOSITORY_URL:$IMAGE_LABEL
- docker pull $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID
- docker tag $CI_REGISTRY_IMAGE/front-init:$CI_PIPELINE_ID $ECR_REPOSITORY_URL:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL:$IMAGE_LABEL
## Deploy the new container in rolling restart
- aws ecs update-service --service=$ECS_APP_STAGING_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
- aws ecs update-service --service=$ECS_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
- sentry-cli releases deploys $CI_PIPELINE_ID new -e $IMAGE_LABEL
dependencies:
- build:production:en
- build:production:i18n
only:
refs:
- master
- test/gitlab-ci
dependencies:
- build:production:en
- build:production:i18n
staging:fpm:
<<: *deploy
stage: deploy:staging
variables:
IMAGE_LABEL: "staging"
ECS_SERVICE: $ECS_APP_STAGING_SERVICE
environment:
name: staging
url: https://www.minds.com # requires staging cookie
deploy:canary:
<<: *deploy
stage: deploy:canary
image: minds/ci:latest
script:
- IMAGE_LABEL="canary"
## Sync assets with CDN
- aws s3 sync dist $S3_REPOSITORY_URL
- $(aws ecr get-login --no-include-email --region us-east-1)
## Update docker front-init container
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
- docker tag $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF $ECR_REPOSITORY_URL:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL:$IMAGE_LABEL
## Deploy the new container in rolling restart
- aws ecs update-service --service=$ECS_APP_CANARY_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
only:
refs:
- master
- test/gitlab-ci
dependencies:
- build:production:en
- build:production:i18n
variables:
IMAGE_LABEL: "canary"
ECS_SERVICE: $ECS_APP_CANARY_SERVICE
environment:
name: canary
url: https://www.minds.com/?canary=1 # requires canary cookie
......@@ -300,30 +288,25 @@ deploy:canary:
allow_failure: false # prevents auto deploy to full production
deploy:production:
<<: *deploy
stage: deploy:production
image: minds/ci:latest
script:
- IMAGE_LABEL="production"
- $(aws ecr get-login --no-include-email --region us-east-1)
## Update docker front-init container
- docker login -u gitlab-ci-token -p ${CI_BUILD_TOKEN} ${CI_REGISTRY}
- docker pull $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF
- docker tag $CI_REGISTRY_IMAGE/front-init:$CI_BUILD_REF $ECR_REPOSITORY_URL:$IMAGE_LABEL
- docker push $ECR_REPOSITORY_URL:$IMAGE_LABEL
## Deploy the new container in rolling restart
- aws ecs update-service --service=$ECS_APP_PRODUCTION_SERVICE --force-new-deployment --region us-east-1 --cluster=$ECS_CLUSTER
## Update sentry
- sentry-cli releases deploys $CI_COMMIT_SHA new -e $IMAGE_LABEL
only:
refs:
- master
- test/gitlab-ci
dependencies:
- build:production:en
- build:production:i18n
variables:
IMAGE_LABEL: "production"
ECS_SERVICE: $ECS_APP_PRODUCTION_SERVICE
environment:
name: production
url: https://www.minds.com
when: delayed
start_in: 2 hours # reduce? can always be deployed manually earlier too
start_in: 12 hours # reduce? can always be deployed manually earlier too
#################
# Cleanup stage #
#################
cleanup:review: # We stop the review site after the e2e tests have run
<<: *cleanup_review
stage: cleanup
except:
refs:
- master
- test/gitlab-ci
# .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
......@@ -28,7 +28,6 @@
"scripts": [
"node_modules/material-design-lite/dist/material.min.js",
"node_modules/medium-editor/dist/js/medium-editor.min.js",
"src/shims/fontawesome.js",
"src/shims/jitsi-api.min.js"
]
},
......@@ -82,7 +81,6 @@
"scripts": [
"node_modules/material-design-lite/dist/material.min.js",
"node_modules/medium-editor/dist/js/medium-editor.min.js",
"src/shims/fontawesome.js",
"src/shims/jitsi-api.min.js"
],
"assets": [
......
......@@ -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>