mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #17450 from overleaf/msm-fix-sp-welcome-page
[web] Make wiki and template links configurable in welcome page GitOrigin-RevId: fab1b8a11f518c5907a5bfa9365ff8e8a130b7c6
This commit is contained in:
+16
-11
@@ -4,6 +4,7 @@ import type { PortalTemplate } from '../../../../../../types/portal-template'
|
||||
import { sendMB } from '../../../../infrastructure/event-tracking'
|
||||
import getMeta from '../../../../utils/meta'
|
||||
import { NewProjectButtonModalVariant } from '../new-project-button/new-project-button-modal'
|
||||
import { ExposedSettings } from '../../../../../../types/exposed-settings'
|
||||
|
||||
type WelcomeMessageCreateNewProjectDropdownProps = {
|
||||
setActiveModal: (modal: NewProjectButtonModalVariant) => void
|
||||
@@ -18,6 +19,8 @@ function WelcomeMessageCreateNewProjectDropdown({
|
||||
| PortalTemplate[]
|
||||
| undefined
|
||||
|
||||
const { isOverleaf } = getMeta('ol-ExposedSettings') as ExposedSettings
|
||||
|
||||
const handleClick = useCallback(() => {
|
||||
sendMB('welcome-page-create-first-project-click', {
|
||||
dropdownMenu: 'main-button',
|
||||
@@ -119,17 +122,19 @@ function WelcomeMessageCreateNewProjectDropdown({
|
||||
>
|
||||
{t('upload_project')}
|
||||
</button>
|
||||
<button
|
||||
onClick={e =>
|
||||
handleDropdownItemClick(
|
||||
e,
|
||||
'import_from_github',
|
||||
'import-from-github'
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('import_from_github')}
|
||||
</button>
|
||||
{isOverleaf && (
|
||||
<button
|
||||
onClick={e =>
|
||||
handleDropdownItemClick(
|
||||
e,
|
||||
'import_from_github',
|
||||
'import-from-github'
|
||||
)
|
||||
}
|
||||
>
|
||||
{t('import_from_github')}
|
||||
</button>
|
||||
)}
|
||||
{(portalTemplates?.length ?? 0) > 0 ? (
|
||||
<>
|
||||
<hr />
|
||||
|
||||
@@ -5,12 +5,18 @@ import type { NewProjectButtonModalVariant } from './new-project-button/new-proj
|
||||
import type { Nullable } from '../../../../../types/utils'
|
||||
import WelcomeMessageLink from './welcome-message-new/welcome-message-link'
|
||||
import WelcomeMessageCreateNewProjectDropdown from './welcome-message-new/welcome-message-create-new-project-dropdown'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { ExposedSettings } from '../../../../../types/exposed-settings'
|
||||
|
||||
export default function WelcomeMessage() {
|
||||
const { t } = useTranslation()
|
||||
const [activeModal, setActiveModal] =
|
||||
useState<Nullable<NewProjectButtonModalVariant>>(null)
|
||||
|
||||
const { wikiEnabled, templatesEnabled } = getMeta(
|
||||
'ol-ExposedSettings'
|
||||
) as ExposedSettings
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="card welcome-new-wrapper">
|
||||
@@ -20,17 +26,21 @@ export default function WelcomeMessage() {
|
||||
<WelcomeMessageCreateNewProjectDropdown
|
||||
setActiveModal={modal => setActiveModal(modal)}
|
||||
/>
|
||||
<WelcomeMessageLink
|
||||
imgSrc="/img/welcome-page/learn-latex.svg"
|
||||
title="Learn LaTeX with a tutorial"
|
||||
href="/learn/latex/Learn_LaTeX_in_30_minutes"
|
||||
target="_blank"
|
||||
/>
|
||||
<WelcomeMessageLink
|
||||
imgSrc="/img/welcome-page/browse-templates.svg"
|
||||
title="Browse templates"
|
||||
href="/templates"
|
||||
/>
|
||||
{wikiEnabled && (
|
||||
<WelcomeMessageLink
|
||||
imgSrc="/img/welcome-page/learn-latex.svg"
|
||||
title="Learn LaTeX with a tutorial"
|
||||
href="/learn/latex/Learn_LaTeX_in_30_minutes"
|
||||
target="_blank"
|
||||
/>
|
||||
)}
|
||||
{templatesEnabled && (
|
||||
<WelcomeMessageLink
|
||||
imgSrc="/img/welcome-page/browse-templates.svg"
|
||||
title="Browse templates"
|
||||
href="/templates"
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user