From 99c786ced5ecda1ed31ba8bb86a86e93519d0d97 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Thu, 11 Apr 2024 19:46:07 +0200 Subject: [PATCH] Tweaks for the final version on registration and theming --- client/modules/App/App.jsx | 2 +- client/modules/IDE/reducers/preferences.js | 4 ++-- client/modules/Mobile/MobileDashboardView.jsx | 2 +- client/styles/abstracts/_variables.scss | 2 +- client/styles/components/_editor.scss | 1 + client/styles/components/_forms.scss | 2 +- client/styles/components/_toolbar.scss | 2 +- server/models/user.js | 4 ++-- server/server.js | 18 ++++++++++++++---- server/views/index.js | 2 +- 10 files changed, 25 insertions(+), 14 deletions(-) diff --git a/client/modules/App/App.jsx b/client/modules/App/App.jsx index 3b74e1fc..355b54c4 100644 --- a/client/modules/App/App.jsx +++ b/client/modules/App/App.jsx @@ -65,7 +65,7 @@ App.propTypes = { App.defaultProps = { children: null, language: null, - theme: 'light' + theme: 'dark' }; const mapStateToProps = state => ({ diff --git a/client/modules/IDE/reducers/preferences.js b/client/modules/IDE/reducers/preferences.js index 3ed39bef..289ef3a5 100644 --- a/client/modules/IDE/reducers/preferences.js +++ b/client/modules/IDE/reducers/preferences.js @@ -11,8 +11,8 @@ const initialState = { textOutput: false, gridOutput: false, soundOutput: false, - theme: 'light', - autorefresh: false, + theme: 'dark', + autorefresh: true, language: 'en-US' }; diff --git a/client/modules/Mobile/MobileDashboardView.jsx b/client/modules/Mobile/MobileDashboardView.jsx index b6e6302e..725f799c 100644 --- a/client/modules/Mobile/MobileDashboardView.jsx +++ b/client/modules/Mobile/MobileDashboardView.jsx @@ -22,7 +22,7 @@ import FooterTabSwitcher from '../../components/mobile/TabSwitcher'; import FooterTab from '../../components/mobile/Tab'; import Loader from '../App/components/loader'; -const EXAMPLE_USERNAME = process.env.EXAMPLE_USERNAME || 'p5'; +const EXAMPLE_USERNAME = process.env.EXAMPLE_USERNAME || 'digitalplayground'; // @ghalestrilo 08/13/2020: I'm sorry const ContentWrapper = styled(Content)` diff --git a/client/styles/abstracts/_variables.scss b/client/styles/abstracts/_variables.scss index ada053ce..628a196c 100644 --- a/client/styles/abstracts/_variables.scss +++ b/client/styles/abstracts/_variables.scss @@ -1,4 +1,4 @@ -$base-font-size: 12; +$base-font-size: 20; //colors $p5js-pink: #FFE117; /*DP Colours*/ diff --git a/client/styles/components/_editor.scss b/client/styles/components/_editor.scss index 7fc22f8e..438b5bce 100644 --- a/client/styles/components/_editor.scss +++ b/client/styles/components/_editor.scss @@ -1,6 +1,7 @@ .CodeMirror { font-family: Inconsolata, monospace; height: 100%; + font-size:$base-font-size !important; } .CodeMirror-linenumbers { diff --git a/client/styles/components/_forms.scss b/client/styles/components/_forms.scss index 54b00447..5b020ae8 100644 --- a/client/styles/components/_forms.scss +++ b/client/styles/components/_forms.scss @@ -37,7 +37,7 @@ } .form__label { - font-size: #{12 / $base-font-size}rem; + font-size: #{16 / $base-font-size}rem; margin-top: #{25 / $base-font-size}rem; margin-bottom: #{7 / $base-font-size}rem; display: block; diff --git a/client/styles/components/_toolbar.scss b/client/styles/components/_toolbar.scss index 5d974bb5..cec552ae 100644 --- a/client/styles/components/_toolbar.scss +++ b/client/styles/components/_toolbar.scss @@ -158,7 +158,7 @@ color: getThemifyVariable('secondary-text-color'); } margin-left: #{5 / $base-font-size}rem; - font-size: #{12 / $base-font-size}rem; + font-size: #{15 / $base-font-size}rem; } .toolbar__edit-name-button { diff --git a/server/models/user.js b/server/models/user.js index 045aeafb..33f9fad2 100644 --- a/server/models/user.js +++ b/server/models/user.js @@ -64,8 +64,8 @@ const userSchema = new Schema({ textOutput: { type: Boolean, default: false }, gridOutput: { type: Boolean, default: false }, soundOutput: { type: Boolean, default: false }, - theme: { type: String, default: 'light' }, - autorefresh: { type: Boolean, default: false }, + theme: { type: String, default: 'dark' }, + autorefresh: { type: Boolean, default: true }, language: { type: String, default: 'en-US' } }, totalSize: { type: Number, default: 0 } diff --git a/server/server.js b/server/server.js index 61168412..f9949215 100644 --- a/server/server.js +++ b/server/server.js @@ -191,16 +191,26 @@ app.use('/api', (error, req, res, next) => { // overview of users: app.get('/users', (req, res) => { - User.collection.getIndexes().then((indexes) =>{ - + // hacky migration here + User.collection.getIndexes(({full: true})).then((indexes) =>{ console.log('indexes', indexes); + // migrate unique + indexes.forEach(function (index) { + if(index.name !=='email_1') return; + if(!index.unique) return; + console.log('Drop index!', index); + User.collection.dropIndex('email_1'); + console.log('Recreate index!'); + User.collection.createIndex({ email: 1 }, { collation: { locale: 'en', strength: 2 } }); + + }); }) // let results = []; User.find({}).sort({ createdAt: -1 }).exec() .then((users) => { - const usernames = users.map((user) => user.username); + // const usernames = users.map((user) => user.username); let names = ""; res.send(names); }); diff --git a/server/views/index.js b/server/views/index.js index 1fca4095..2a16a1ab 100644 --- a/server/views/index.js +++ b/server/views/index.js @@ -29,7 +29,7 @@ export function renderIndex() { window.process.env.CLIENT = true; window.process.env.LOGIN_ENABLED = ${process.env.LOGIN_ENABLED === 'false' ? false : true}; window.process.env.EXAMPLES_ENABLED = ${process.env.EXAMPLES_ENABLED === 'false' ? false : true}; - window.process.env.EXAMPLE_USERNAME = '${process.env.EXAMPLE_USERNAME || 'p5'}'; + window.process.env.EXAMPLE_USERNAME = '${process.env.EXAMPLE_USERNAME || 'digitalplayground'}'; window.process.env.UI_ACCESS_TOKEN_ENABLED = ${process.env.UI_ACCESS_TOKEN_ENABLED === 'false' ? false : true}; window.process.env.UI_COLLECTIONS_ENABLED = ${process.env.UI_COLLECTIONS_ENABLED === 'false' ? false : true}; window.process.env.UPLOAD_LIMIT = ${process.env.UPLOAD_LIMIT ? `${process.env.UPLOAD_LIMIT}` : undefined};