Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEAB-5820: Mastodon feed widget #1837

Merged
merged 17 commits into from
Oct 16, 2023
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"node_modules/bootstrap/dist/css/bootstrap.css",
"node_modules/academicons/css/academicons.css",
"src/styles.scss",
"src/material.scss",
"src/material.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
Expand All @@ -50,7 +50,7 @@
"node_modules/ace-builds/src-min-noconflict/mode-perl.js",
"node_modules/ace-builds/src-min-noconflict/theme-idle_fingers.js",
"node_modules/ace-builds/src-min-noconflict/ext-searchbox.js",
"node_modules/bootstrap/dist/js/bootstrap.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
]
},
"configurations": {
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/group1/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
verifyGithubLinkDashboard,
checkFeaturedContent,
checkNewsAndUpdates,
checkMastodonFeed,
} from '../../support/commands';

describe('Dockstore dashboard', () => {
Expand Down Expand Up @@ -67,6 +68,11 @@ describe('Dockstore dashboard', () => {
cy.visit('/dashboard');
checkNewsAndUpdates();
});

it('mastodon feed should be visible', () => {
cy.visit('/dashboard');
checkMastodonFeed();
});
});

describe('should display added notebook correctly', () => {
Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/immutableDatabaseTests/app-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ describe('Logged in Dockstore Home', () => {
// expect(browser.getLocationAbsUrl()).toMatch("/");
});

it('should have the twitter timeline', () => {
it('should have the mastodon timeline', () => {
cy.scrollTo('bottom');
cy.get('.twitter-timeline').should('be.visible');
cy.get('[data-cy=mt-toot]').should('be.visible');
});

function starColumn(url: string, type: string) {
Expand Down Expand Up @@ -65,9 +65,9 @@ describe('Logged out Dockstore Home', () => {
cy.get('#youtubeModal').should('not.exist');
});

it('should have the twitter timeline', () => {
it('should have the mastodon timeline', () => {
cy.scrollTo('bottom');
cy.get('.twitter-timeline').should('be.visible');
cy.get('[data-cy=mt-toot]').should('be.visible');
});
});
});
7 changes: 6 additions & 1 deletion cypress/e2e/smokeTests/sharedTests/basic-enduser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ga4ghPath } from '../../../../src/app/shared/constants';
import { ToolDescriptor } from '../../../../src/app/shared/openapi';
import { goToTab, checkFeaturedContent, checkNewsAndUpdates } from '../../../support/commands';
import { goToTab, checkFeaturedContent, checkNewsAndUpdates, checkMastodonFeed } from '../../../support/commands';

// Test an entry, these should be ambiguous between tools, workflows, and notebooks.
describe('run stochastic smoke test', () => {
Expand Down Expand Up @@ -372,6 +372,11 @@ describe('Check extra content', () => {
cy.visit('/');
checkNewsAndUpdates();
});

it('mastodon feed should be visible', () => {
cy.visit('/');
checkMastodonFeed();
});
});

// TODO: uncomment after tooltester logs are fixed
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,3 +277,7 @@ export function checkNewsAndUpdates() {
cy.get('.news-entry').first().contains('a').should('have.attr', 'href');
});
}

export function checkMastodonFeed() {
cy.get('[data-cy=mt-toot]').should('exist');
}
2 changes: 0 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ import { RefreshService } from './shared/refresh.service';
import { ApiModule } from './shared/openapi/api.module';
import { Configuration } from './shared/openapi/configuration';
import { TrackLoginService } from './shared/track-login.service';
import { TwitterService } from './shared/twitter.service';
import { UrlResolverService } from './shared/url-resolver.service';
import { VerifiedByService } from './shared/verified-by.service';
import { SitemapComponent } from './sitemap/sitemap.component';
Expand Down Expand Up @@ -230,7 +229,6 @@ export function initializerFactory(
RegisterCheckerWorkflowService,
RefreshService,
PagenumberService,
TwitterService,
GA4GHV20Service,
DescriptorLanguageService,
UrlResolverService,
Expand Down
13 changes: 13 additions & 0 deletions src/app/footer/footer.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,19 @@
>
</a>
</li>
<li class="m-0">
<a
href="https://genomic.social/@dockstore"
target="_blank"
rel="noopener noreferrer"
class="footer-link"
fxLayoutGap="0.5rem"
>
<img class="site-icons-tab" src="../../assets/images/dockstore/mastodon.svg" alt="small Twitter logo" /><small
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alt text needs update

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alt text needs update

Comment still applicable.

>@dockstore</small
>
</a>
</li>
<li class="m-0">
<a
href="https://www.youtube.com/channel/UCFWNYqxQvVLAuZq8rdOSE4g"
Expand Down
6 changes: 4 additions & 2 deletions src/app/home-page/dashboard/dashboard.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
<div fxFlex.md="65" fxFlex.gt-md="65" fxFlex.lt-md="100" class="py-4">
<app-news-box></app-news-box>
</div>
<div fxFlex.md="35" fxFlex.gt-md="35" fxFlex.lt-md="100">
<div class="my-3 twitter" #twitter></div>
<div class="mt-timeline">
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
<div id="mt-body" class="mt-body" role="feed">
<app-mastodon-timeline></app-mastodon-timeline>
</div>
</div>
</div>
<div class="w-100">
Expand Down
4 changes: 2 additions & 2 deletions src/app/home-page/dashboard/dashboard.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { MatButtonModule } from '@angular/material/button';
import { MatDialogModule } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { RouterTestingModule } from '@angular/router/testing';
import { TwitterService } from '../../shared/twitter.service';
import { DashboardComponent } from './dashboard.component';
import { RegisterToolService } from 'app/container/register-tool/register-tool.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { ContainerService } from '../../shared/container.service';
import { ContainerStubService } from '../../test/service-stubs';
import { MastodonService } from '../../shared/mastodon.service';

describe('DashboardComponent', () => {
let component: DashboardComponent;
Expand All @@ -22,7 +22,7 @@ describe('DashboardComponent', () => {
declarations: [DashboardComponent],
schemas: [NO_ERRORS_SCHEMA],
imports: [RouterTestingModule, MatButtonModule, MatIconModule, MatDialogModule, HttpClientTestingModule, MatSnackBarModule],
providers: [TwitterService, RegisterToolService, { provide: ContainerService, useClass: ContainerStubService }],
providers: [MastodonService, RegisterToolService, { provide: ContainerService, useClass: ContainerStubService }],
}).compileComponents();
})
);
Expand Down
21 changes: 1 addition & 20 deletions src/app/home-page/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { RegisterToolService } from 'app/container/register-tool/register-tool.s
import { MatDialog } from '@angular/material/dialog';
import { RegisterToolComponent } from 'app/container/register-tool/register-tool.component';
import { AlertService } from 'app/shared/alert/state/alert.service';
import { TwitterService } from 'app/shared/twitter.service';
import { Dockstore } from 'app/shared/dockstore.model';
import { EntryType } from '../../shared/openapi';

Expand All @@ -17,17 +16,11 @@ import { EntryType } from '../../shared/openapi';
export class DashboardComponent extends Base implements OnInit {
public Dockstore = Dockstore;
@ViewChild('twitter') twitterElement: ElementRef;
constructor(
private registerToolService: RegisterToolService,
private dialog: MatDialog,
private alertService: AlertService,
private twitterService: TwitterService
) {
constructor(private registerToolService: RegisterToolService, private dialog: MatDialog, private alertService: AlertService) {
super();
}

ngOnInit() {
this.loadTwitterWidget();
this.registerToolService.isModalShown.pipe(takeUntil(this.ngUnsubscribe)).subscribe((isModalShown: boolean) => {
if (isModalShown) {
const dialogRef = this.dialog.open(RegisterToolComponent, { width: '500px' });
Expand All @@ -44,17 +37,5 @@ export class DashboardComponent extends Base implements OnInit {
});
}

private loadTwitterWidget() {
this.twitterService
.loadScript()
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(
() => {
this.twitterService.createTimeline(this.twitterElement, 2);
},
(error) => console.error(error)
);
}

protected readonly EntryType = EntryType;
}
6 changes: 4 additions & 2 deletions src/app/home-page/home-logged-out/home.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,10 @@ <h5 class="mb-0">
<span>Discourse forum about helpful Dockstore topics.</span>
</div>
</div>
<div fxFlex.md="33" fxFlex.gt-md="33" fxFlex.lt-md="100">
<div class="my-3 twitter" #twitter></div>
<div class="mt-timeline">
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
<div id="mt-body" class="mt-body" role="feed">
hyunnaye marked this conversation as resolved.
Show resolved Hide resolved
<app-mastodon-timeline></app-mastodon-timeline>
</div>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/home-page/home-logged-out/home.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { DescriptorLanguageService } from 'app/shared/entry/descriptor-language.service';
import { CustomMaterialModule } from 'app/shared/modules/material.module';
import { TwitterService } from '../../shared/twitter.service';
import { HomeComponent } from './home.component';
import { MastodonService } from '../../shared/mastodon.service';

describe('HomeComponent', () => {
let component: HomeComponent;
Expand All @@ -33,7 +33,7 @@ describe('HomeComponent', () => {
declarations: [HomeComponent],
schemas: [NO_ERRORS_SCHEMA],
imports: [CustomMaterialModule, RouterTestingModule, HttpClientTestingModule, BrowserAnimationsModule],
providers: [TwitterService, DescriptorLanguageService],
providers: [MastodonService, DescriptorLanguageService],
}).compileComponents();
})
);
Expand Down
18 changes: 1 addition & 17 deletions src/app/home-page/home-logged-out/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Dockstore } from '../../shared/dockstore.model';
import { User } from '../../shared/openapi/model/user';
import { TwitterService } from '../../shared/twitter.service';
import { UserQuery } from '../../shared/user/user.query';
import { Category } from '../../shared/openapi';
import { AllCategoriesService } from '../../categories/state/all-categories.service';
Expand Down Expand Up @@ -61,7 +60,6 @@ export class HomeComponent extends Base implements OnInit, AfterViewInit {

constructor(
private dialog: MatDialog,
private twitterService: TwitterService,
private userQuery: UserQuery,
private homePageService: HomePageService,
private allCategoriesService: AllCategoriesService
Expand All @@ -77,21 +75,7 @@ export class HomeComponent extends Base implements OnInit, AfterViewInit {
this.orgSchema = this.homePageService.hpOrgSchema;
this.websiteSchema = this.homePageService.hpWebsiteSchema;
}
ngAfterViewInit() {
this.loadTwitterWidget();
}

loadTwitterWidget() {
this.twitterService
.loadScript()
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(
() => {
this.twitterService.createTimeline(this.twitterElement, 2);
},
(err) => console.error(err)
);
}
ngAfterViewInit() {}

goToSearch(searchValue: string) {
this.homePageService.goToSearch(searchValue);
Expand Down
2 changes: 2 additions & 0 deletions src/app/home-page/home-page.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { HeaderModule } from 'app/shared/modules/header.module';
import { NewsBoxComponent } from './widget/news-box/news-box.component';
import { MarkdownWrapperModule } from '../shared/modules/markdown-wrapper.module';
import { PreviewWarningModule } from '../shared/modules/preview-warning.module';
import { MastodonComponent } from '../shared/mastodon/mastodon.component';

@NgModule({
imports: [
Expand Down Expand Up @@ -69,6 +70,7 @@ import { PreviewWarningModule } from '../shared/modules/preview-warning.module';
OrganizationBoxComponent,
StarredBoxComponent,
NewsBoxComponent,
MastodonComponent,
],
providers: [
MytoolsService,
Expand Down
Loading