2019-12-26 22:10:19 +05:30
|
|
|
const DEFAULT_TITLE = '· GitLab';
|
2019-09-04 21:01:54 +05:30
|
|
|
// eslint-disable-next-line import/prefer-default-export
|
|
|
|
export const setTitle = (pathMatch, ref, project) => {
|
2019-12-26 22:10:19 +05:30
|
|
|
if (!pathMatch) {
|
|
|
|
document.title = `${project} ${DEFAULT_TITLE}`;
|
|
|
|
return;
|
|
|
|
}
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
const path = pathMatch.replace(/^\//, '');
|
|
|
|
const isEmpty = path === '';
|
|
|
|
|
|
|
|
/* eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings */
|
2019-12-26 22:10:19 +05:30
|
|
|
document.title = `${isEmpty ? 'Files' : path} · ${ref} · ${project} ${DEFAULT_TITLE}`;
|
2019-09-04 21:01:54 +05:30
|
|
|
};
|