Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean config.js #580

Open
samsammurphy opened this issue Jul 1, 2020 · 3 comments
Open

clean config.js #580

samsammurphy opened this issue Jul 1, 2020 · 3 comments
Labels
tech code cleaning etc...

Comments

@samsammurphy
Copy link
Contributor

The longer object definitions in config.js could perhaps be separated into new files (e.g. PAGES into pages.js and PHOTO_FIELDS into photo_fields.js to make it easier to read.

This would be similar to behaviour elsewhere in the config.js file for example importing from categories.js and strings.js.

These configuration files could be kept in a subfolder, e.g. custom/configurations.

@samsammurphy
Copy link
Contributor Author

Additionally, it would mean all of the following code could be moved out of config.js and into custom/configurations/pages.js

import React from "react";

import AccountCircleIcon from "@material-ui/icons/AccountCircle";
import CheckCircleIcon from "@material-ui/icons/CheckCircle";
import PhotoAlbumIcon from "@material-ui/icons/PhotoAlbum";
import SchoolIcon from "@material-ui/icons/School";
import DashboardIcon from "@material-ui/icons/Dashboard";
import HelpIcon from "@material-ui/icons/Help";
import FeedbackIcon from "@material-ui/icons/Feedback";
import LibraryBooksIcon from "@material-ui/icons/LibraryBooks";

@samsammurphy
Copy link
Contributor Author

These simple imports

import { CUSTOM_STRING } from "./configurations/strings.js";
import { PAGES } from './configurations/pages.js'
import { PHOTO_FIELDS } from './configurations/photo_fields.js'

Reduced up config.js from over 200 lines of code to around 60. This separation of concerns makes it much easier to read, understand and configure imo. Happy to PR.

@sebastianovide sebastianovide added the tech code cleaning etc... label Jul 3, 2020
@sebastianovide
Copy link
Contributor

agree. This file requires some love

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech code cleaning etc...
Projects
None yet
Development

No branches or pull requests

2 participants