Merge pull request #29152 from overleaf/dp-dashboard-dark-mode
Add data-theme attribute to project list page GitOrigin-RevId: 3a623e3258d55e01f0911bcc45b78bcdba21745b
This commit is contained in:
@@ -50,6 +50,7 @@ import UserGetter from '../User/UserGetter.js'
|
||||
import { isStandaloneAiAddOnPlanCode } from '../Subscription/AiHelper.js'
|
||||
import SubscriptionController from '../Subscription/SubscriptionController.mjs'
|
||||
import { formatCurrency } from '../../util/currency.js'
|
||||
import UserSettingsHelper from './UserSettingsHelper.mjs'
|
||||
|
||||
const { ObjectId } = mongodb
|
||||
/**
|
||||
@@ -811,22 +812,7 @@ const _ProjectController = {
|
||||
isMemberOfGroupSubscription: userIsMemberOfGroupSubscription,
|
||||
hasInstitutionLicence: userHasInstitutionLicence,
|
||||
},
|
||||
userSettings: {
|
||||
mode: user.ace.mode,
|
||||
editorTheme: user.ace.theme,
|
||||
fontSize: user.ace.fontSize,
|
||||
autoComplete: user.ace.autoComplete,
|
||||
autoPairDelimiters: user.ace.autoPairDelimiters,
|
||||
pdfViewer: user.ace.pdfViewer,
|
||||
syntaxValidation: user.ace.syntaxValidation,
|
||||
fontFamily: user.ace.fontFamily || 'lucida',
|
||||
lineHeight: user.ace.lineHeight || 'normal',
|
||||
overallTheme: user.ace.overallTheme,
|
||||
mathPreview: user.ace.mathPreview,
|
||||
breadcrumbs: user.ace.breadcrumbs,
|
||||
referencesSearchMode: user.ace.referencesSearchMode,
|
||||
enableNewEditor: user.ace.enableNewEditor ?? true,
|
||||
},
|
||||
userSettings: UserSettingsHelper.buildUserSettings(user),
|
||||
labsExperiments: user.labsExperiments ?? [],
|
||||
privilegeLevel,
|
||||
anonymous,
|
||||
|
||||
@@ -31,6 +31,7 @@ import SubscriptionHelper from '../Subscription/SubscriptionHelper.js'
|
||||
import PermissionsManager from '../Authorization/PermissionsManager.mjs'
|
||||
import AnalyticsManager from '../Analytics/AnalyticsManager.js'
|
||||
import { OnboardingDataCollection } from '../../models/OnboardingDataCollection.js'
|
||||
import UserSettingsHelper from './UserSettingsHelper.mjs'
|
||||
|
||||
/**
|
||||
* @import { GetProjectsRequest, GetProjectsResponse, AllUsersProjects, MongoProject, FormattedProject, MongoTag } from "./types"
|
||||
@@ -164,7 +165,7 @@ async function projectListPage(req, res, next) {
|
||||
})
|
||||
const user = await User.findById(
|
||||
userId,
|
||||
`email emails features alphaProgram betaProgram lastPrimaryEmailCheck lastActive signUpDate refProviders${
|
||||
`email emails features alphaProgram betaProgram lastPrimaryEmailCheck lastActive signUpDate ace refProviders${
|
||||
isSaas ? ' enrollment writefull completedTutorials aiErrorAssistant' : ''
|
||||
}`
|
||||
)
|
||||
@@ -537,6 +538,12 @@ async function projectListPage(req, res, next) {
|
||||
}
|
||||
}
|
||||
|
||||
await SplitTestHandler.promises.getAssignment(
|
||||
req,
|
||||
res,
|
||||
'themed-project-dashboard'
|
||||
)
|
||||
|
||||
res.render('project/list-react', {
|
||||
title: 'your_projects',
|
||||
usersBestSubscription,
|
||||
@@ -545,6 +552,7 @@ async function projectListPage(req, res, next) {
|
||||
user,
|
||||
userAffiliations,
|
||||
userEmails,
|
||||
userSettings: UserSettingsHelper.buildUserSettings(user),
|
||||
reconfirmedViaSAML,
|
||||
allInReconfirmNotificationPeriods,
|
||||
survey,
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
function buildUserSettings(user) {
|
||||
return {
|
||||
mode: user.ace.mode,
|
||||
editorTheme: user.ace.theme,
|
||||
fontSize: user.ace.fontSize,
|
||||
autoComplete: user.ace.autoComplete,
|
||||
autoPairDelimiters: user.ace.autoPairDelimiters,
|
||||
pdfViewer: user.ace.pdfViewer,
|
||||
syntaxValidation: user.ace.syntaxValidation,
|
||||
fontFamily: user.ace.fontFamily || 'lucida',
|
||||
lineHeight: user.ace.lineHeight || 'normal',
|
||||
overallTheme: user.ace.overallTheme,
|
||||
mathPreview: user.ace.mathPreview,
|
||||
breadcrumbs: user.ace.breadcrumbs,
|
||||
referencesSearchMode: user.ace.referencesSearchMode,
|
||||
enableNewEditor: user.ace.enableNewEditor ?? true,
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
buildUserSettings,
|
||||
}
|
||||
Reference in New Issue
Block a user