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

[ENG-4818] Use provider favicon for preprint discover page #2032

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/preprints/discover/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@ import Route from '@ember/routing/route';
import RouterService from '@ember/routing/router-service';
import { inject as service } from '@ember/service';
import config from 'ember-osf-web/config/environment';
import PreprintProviderModel from 'ember-osf-web/models/preprint-provider';

import MetaTags, { HeadTagDef } from 'ember-osf-web/services/meta-tags';
import Theme from 'ember-osf-web/services/theme';

export default class PreprintDiscoverRoute extends Route {
@service store!: Store;
@service theme!: Theme;
@service router!: RouterService;
@service metaTags!: MetaTags;
headTags?: HeadTagDef[];

buildRouteInfoMetadata() {
return {
Expand All @@ -36,6 +40,20 @@ export default class PreprintDiscoverRoute extends Route {
}
}

// TODO: Move this to app/preprints/index/route.ts when landing page PR is merged
afterModel(model: PreprintProviderModel) {
if (model && model.assets && model.assets.favicon) {
const headTags = [{
type: 'link',
attrs: {
rel: 'icon',
href: model.assets.favicon,
},
}];
this.set('headTags', headTags);
}
}

deactivate() {
this.theme.reset();
}
Expand Down