mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #18997 from overleaf/mj-fix-uncategorized-title
[web] Correct title when viewing uncategorized projects GitOrigin-RevId: 6f284c437563f10125974eac7f6da6c92526e436
This commit is contained in:
parent
69205629bf
commit
922822d487
6 changed files with 24 additions and 2 deletions
|
@ -1475,6 +1475,7 @@
|
||||||
"turn_on_link_sharing": "",
|
"turn_on_link_sharing": "",
|
||||||
"unarchive": "",
|
"unarchive": "",
|
||||||
"uncategorized": "",
|
"uncategorized": "",
|
||||||
|
"uncategorized_projects": "",
|
||||||
"unconfirmed": "",
|
"unconfirmed": "",
|
||||||
"undelete": "",
|
"undelete": "",
|
||||||
"undeleting": "",
|
"undeleting": "",
|
||||||
|
|
|
@ -61,7 +61,7 @@ function ProjectsDropdown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedTagId === UNCATEGORIZED_KEY) {
|
if (selectedTagId === UNCATEGORIZED_KEY) {
|
||||||
setTitle(t('uncategorized'))
|
setTitle(t('uncategorized_projects'))
|
||||||
} else {
|
} else {
|
||||||
const tag = tags.find(({ _id: id }) => id === selectedTagId)
|
const tag = tags.find(({ _id: id }) => id === selectedTagId)
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,7 @@ function ProjectListPageContent() {
|
||||||
<ProjectListTitle
|
<ProjectListTitle
|
||||||
filter={filter}
|
filter={filter}
|
||||||
selectedTag={selectedTag}
|
selectedTag={selectedTag}
|
||||||
|
selectedTagId={selectedTagId}
|
||||||
className="hidden-xs text-truncate"
|
className="hidden-xs text-truncate"
|
||||||
/>
|
/>
|
||||||
<div className="project-tools">
|
<div className="project-tools">
|
||||||
|
|
|
@ -1,21 +1,25 @@
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import { Tag } from '../../../../../../app/src/Features/Tags/types'
|
import { Tag } from '../../../../../../app/src/Features/Tags/types'
|
||||||
import { Filter } from '../../context/project-list-context'
|
import { Filter, UNCATEGORIZED_KEY } from '../../context/project-list-context'
|
||||||
|
|
||||||
function ProjectListTitle({
|
function ProjectListTitle({
|
||||||
filter,
|
filter,
|
||||||
selectedTag,
|
selectedTag,
|
||||||
|
selectedTagId,
|
||||||
className,
|
className,
|
||||||
}: {
|
}: {
|
||||||
filter: Filter
|
filter: Filter
|
||||||
selectedTag: Tag | undefined
|
selectedTag: Tag | undefined
|
||||||
|
selectedTagId: string | undefined
|
||||||
className?: string
|
className?: string
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
let message = t('projects')
|
let message = t('projects')
|
||||||
if (selectedTag) {
|
if (selectedTag) {
|
||||||
message = `${selectedTag.name}`
|
message = `${selectedTag.name}`
|
||||||
|
} else if (selectedTagId === UNCATEGORIZED_KEY) {
|
||||||
|
message = t('uncategorized_projects')
|
||||||
} else {
|
} else {
|
||||||
switch (filter) {
|
switch (filter) {
|
||||||
case 'all':
|
case 'all':
|
||||||
|
|
|
@ -2085,6 +2085,7 @@
|
||||||
"unable_to_extract_the_supplied_zip_file": "Opening this content on Overleaf failed because the zip file could not be extracted. Please ensure that it is a valid zip file. If this keeps happening for links on a particular site, please report this to them.",
|
"unable_to_extract_the_supplied_zip_file": "Opening this content on Overleaf failed because the zip file could not be extracted. Please ensure that it is a valid zip file. If this keeps happening for links on a particular site, please report this to them.",
|
||||||
"unarchive": "Restore",
|
"unarchive": "Restore",
|
||||||
"uncategorized": "Uncategorized",
|
"uncategorized": "Uncategorized",
|
||||||
|
"uncategorized_projects": "Uncategorized Projects",
|
||||||
"unconfirmed": "Unconfirmed",
|
"unconfirmed": "Unconfirmed",
|
||||||
"undelete": "Undelete",
|
"undelete": "Undelete",
|
||||||
"undeleting": "Undeleting",
|
"undeleting": "Undeleting",
|
||||||
|
|
|
@ -8,6 +8,7 @@ describe('<ProjectListTitle />', function () {
|
||||||
filter: Filter
|
filter: Filter
|
||||||
selectedTag: Tag | undefined
|
selectedTag: Tag | undefined
|
||||||
expectedText: string
|
expectedText: string
|
||||||
|
selectedTagId: string | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const testCases: Array<TestCase> = [
|
const testCases: Array<TestCase> = [
|
||||||
|
@ -16,37 +17,50 @@ describe('<ProjectListTitle />', function () {
|
||||||
filter: 'all',
|
filter: 'all',
|
||||||
selectedTag: undefined,
|
selectedTag: undefined,
|
||||||
expectedText: 'all projects',
|
expectedText: 'all projects',
|
||||||
|
selectedTagId: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filter: 'owned',
|
filter: 'owned',
|
||||||
selectedTag: undefined,
|
selectedTag: undefined,
|
||||||
expectedText: 'your projects',
|
expectedText: 'your projects',
|
||||||
|
selectedTagId: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filter: 'shared',
|
filter: 'shared',
|
||||||
selectedTag: undefined,
|
selectedTag: undefined,
|
||||||
expectedText: 'shared with you',
|
expectedText: 'shared with you',
|
||||||
|
selectedTagId: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filter: 'archived',
|
filter: 'archived',
|
||||||
selectedTag: undefined,
|
selectedTag: undefined,
|
||||||
expectedText: 'archived projects',
|
expectedText: 'archived projects',
|
||||||
|
selectedTagId: undefined,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filter: 'trashed',
|
filter: 'trashed',
|
||||||
selectedTag: undefined,
|
selectedTag: undefined,
|
||||||
expectedText: 'trashed projects',
|
expectedText: 'trashed projects',
|
||||||
|
selectedTagId: undefined,
|
||||||
},
|
},
|
||||||
// Tags
|
// Tags
|
||||||
|
{
|
||||||
|
filter: 'all',
|
||||||
|
selectedTag: undefined,
|
||||||
|
expectedText: 'uncategorized',
|
||||||
|
selectedTagId: 'uncategorized',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
filter: 'all',
|
filter: 'all',
|
||||||
selectedTag: { _id: '', user_id: '', name: 'sometag' },
|
selectedTag: { _id: '', user_id: '', name: 'sometag' },
|
||||||
expectedText: 'sometag',
|
expectedText: 'sometag',
|
||||||
|
selectedTagId: '',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
filter: 'shared',
|
filter: 'shared',
|
||||||
selectedTag: { _id: '', user_id: '', name: 'othertag' },
|
selectedTag: { _id: '', user_id: '', name: 'othertag' },
|
||||||
expectedText: 'othertag',
|
expectedText: 'othertag',
|
||||||
|
selectedTagId: '',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -56,6 +70,7 @@ describe('<ProjectListTitle />', function () {
|
||||||
<ProjectListTitle
|
<ProjectListTitle
|
||||||
filter={testCase.filter}
|
filter={testCase.filter}
|
||||||
selectedTag={testCase.selectedTag}
|
selectedTag={testCase.selectedTag}
|
||||||
|
selectedTagId={testCase.selectedTagId}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
screen.getByText(new RegExp(testCase.expectedText, 'i'))
|
screen.getByText(new RegExp(testCase.expectedText, 'i'))
|
||||||
|
|
Loading…
Reference in a new issue