Code Monkey home page Code Monkey logo

ynab-absa-csv-convert-js's People

Contributors

bgrgicak avatar kdevnel avatar maksymalist avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

ynab-absa-csv-convert-js's Issues

Test links at the bottom of the chart

Each time I click submit, I get two links with the word test at the bottom of the table.

Ideally, there should be only one link, and it should have a descriptive name.

Screenshot 2021-06-21 at 10 08 57

Move to using modules

In order to prepare for integrating webpack and to manage the size of the codebase as it grows let's move to using JS modules to split up the code.

Change table generator to use a configuration array and document.createElement

This table generator works, but it's not the standard JS way of doing things.
Ideally, you would use document.createElement to generate HTML, this isn't a must-have, but it's a good practice.

What if you would use a configuration array to define what goes into the table and how it's structured. In that case, your outputHTML function would use that configuration to generate both the header and content parts.
An example configuration could be (see The pragmatic programmer
Metaprogramming
):

[
  {
    header: 'Date',
    key: 'Date',
  },
  {
    header: 'Memo',
    key: 'Memo',
  },
]

Originally posted by @bgrgicak in #8 (comment)

Project review June 7th

Issues

  • npm init should be replaced with npm install
  • Currently, I can upload an invalid file (output-sample.csv), and the page accepts it. Ideally, the app should warn that the file is invalid and refuse to render it.
  • Each submit adds an additional download link. There should be just one link (see screenshot 1)
  • CSS uses HTML tags for styling, this is a bad practice. CSS classes should be used instead.
  • The memo specific logic should be in one place only to improve readability and make the code simpler. I suggest adding memo to the switch.
  • Using names like array and string doesn't describe the variable content. The variable content should be clear from reading the name. This can produce long variable names, but that's ok.
  • Rename test to something descriptive
  • Use JS and a configuration file to render the output table instead of HTML strings. (Tip: this configuration file can also be used for data validation)

Improvements

  • Add export unit tests (just for fun ๐Ÿ˜„)
  • Move consts in app.js to the callback.
  • Add CSS prefixing to Webpack. This will automatically add prefixes like -webkit-appearance to CSS and ensure browser support.
  • It's a good practice not to use anonymous functions, but to move callbacks to proper functions. This would also avoid nested anonymous callbacks like in this callback.
  • It would be nice to reuse the import file name for the export filename and just add an extension at the end (e.g. input-sample-export.csv).

Questions

  • Why is the CSS bundled inside JS?
  • Would it make sense to move the submit callback to a separate file?

Screenshots

Screenshot 1

Screenshot 2021-06-07 at 08 45 01

Validate input file before processing

From #20

Currently, I can upload an invalid file (output-sample.csv), and the page accepts it. Ideally, the app should warn that the file is invalid and refuse to render it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.