Skip to content

Conversation

@CelesteNaude
Copy link

No description provided.

app.ts Outdated
@@ -0,0 +1,366 @@

let state = {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No point in defining the state object, rather define the attributes as they are.

app.ts Outdated

// These are 'technically' constants
let RECORDCOUNT = 350;
let HEADERS = ["ID", "City", "Population"];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no point in giving these variables values, rather just define them with an appropriate type.

app.ts Outdated
let HEADERS = ["ID", "City", "Population"];

// 'Global' get element
function el(element: string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this function as it just adds more overhead.

rather declare your document elements once so that you can reference them without having to call functions.

app.ts Outdated
// Fetch headers and record count
async function getData() {
// API calls for record count and headers
RECORDCOUNT = await (await fetch('/recordCount')).json();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather use this format:
await fetch(url).then(resp => {...})
and assign the values you need from resp

app.ts Outdated
async function getData() {
// API calls for record count and headers
RECORDCOUNT = await (await fetch('/recordCount')).json();
HEADERS = await (await fetch('/columns')).json();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

app.ts Outdated
async function deleteRows(newHeight: number, diff: number) {
let table = el("content-table");
let tableBody = table?.querySelector("tbody");
let num = newHeight - 1

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing semicolon ;

app.ts Outdated
}
else if (diff > 0 && state.trimEnd == RECORDCOUNT - 1) {
// Prepend rows as last page gets bigger
let timeoutId: ReturnType<typeof setTimeout>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove timeoutId, as it is not used

app.ts Outdated
window.onload = () => {
state.trimStart = 0
state.trimEnd = state.trimStart + state.records - 1;
el('first')?.setAttribute("disabled", "disabled");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

app.ts Outdated
// > ))))))))))))))))={
// `, ))))))\ \)))))))={
// ',))))))))\/)))))' \{
// '*O))))))))O*'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just keep swimming

@@ -0,0 +1,197 @@

html {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a number of indentation issues are, make sure that your spacing is correct.

Copy link

@anzelIMQS anzelIMQS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some cleaning up and logical separation stuff. Otherwise, it looks awesome.

app.ts Outdated


// These are 'technically' constants
let RECORDCOUNT = 350;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be a better idea to only define the global variables and not initialize them. Let the backend populate them accordingly even though we know what the values will be 😋. They shouldn't be considered as constants.

app.ts Outdated
}
else if (diff > 0 && state.trimEnd == RECORDCOUNT - 1) {
// Prepend rows as last page gets bigger
let timeoutId: ReturnType<typeof setTimeout>;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the unused variable

app.ts Outdated

state.countRec = state.countRec + diff;
state.trimEnd = state.trimEnd + diff;
state.records = newHeight;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state.records = newHeight; is a line that gets repeated in all your conditional cases. Try to remove some repetition and optimise your if and else statements to only apply the necessary logic and have a clean look.

state.records = newHeight; can be called after your if/else statements then it is not necessary for the last else.

app.ts Outdated
start = state.trimStart - addTop;

for (let i = end; i >= start; i--) {
let recordsLink = "/records?from=" + i + "&to=" + i;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to remove the repetition for creating the link string and parsing it as a parameter.

Rather change the "addRows/prependRows" function to accept the start and end variables as parameters as well and create the link string inside that function.

app.ts Outdated


// Add rows to table
async function addRows(link: string) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can change the addRows function to accept a boolean as a parameter e.g. prepend. This boolean can determine if you want to append or prepend. Then it won't be necessary for the prependRows function. They have the exact same functionality.

Suggested change
async function addRows(link: string) {
async function addRows(link: string, prepend?: boolean) {

app.ts Outdated
cellElement.textContent = cellText;
rowElement.appendChild(cellElement); // Append cells
}
tableBody?.appendChild(rowElement); // Append rows

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add the prepend if statement

app.ts Outdated
end = state.trimStart - 1;
start = state.trimStart - diff;

for (let i = end; i >= start; i--) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary for a for loop though? It's not too efficient to fetch the records one-by-one.

Try to only request your batch of records once and handle the prepending logic only after that inside the "addRows/prependRows" function i.e your backward loop.

@geraldtivatyi
Copy link

I think Pierre and Anzel covered everything I saw: especially on the repetitive code. And yes.. just keep swimming lol.

Copy link
Contributor

@FritzOnFire FritzOnFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part 1 of the review, only got through the app.ts file, will do the rest later

app.ts Outdated
Comment on lines 2 to 21
let records = Math.floor((window.innerHeight - 160) / 40); // Estimate of available table space
let trimStart: number;
let trimEnd: number;
let countRec: number;
let isAppend: boolean;

// Variables fetched once with load of window
let RECORDCOUNT: number;
let HEADERS: string[];

// Global document elements
let contentTable: HTMLElement | null = document.getElementById('content-table');
let tableBody: HTMLTableSectionElement | null = contentTable!.querySelector("tbody");
let tableHead: HTMLElement | null = document.getElementById("content-thead");
let pageInfo: HTMLElement | null = document.getElementById('page-info');
let firstBtn: HTMLElement | null = document.getElementById('first');
let prevBtn: HTMLElement | null = document.getElementById('prev');
let nextBtn: HTMLElement | null = document.getElementById('next');
let lastBtn: HTMLElement | null = document.getElementById('last');
let inputBox: HTMLElement | null = document.getElementById('id-search');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global variables are bad. Please move them into a class.

app.ts Outdated
Comment on lines 27 to 28
RECORDCOUNT = await fetch('/recordCount')
.then(resp => resp.json());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you rather want to set the value of RECORDCOUNT inside another then, like so:

.then(resp => {
    // Check resp code for issues and `throw` if something went wrong.
    return resp.json();
})
.then(count => {
    RECORDCOUNT = count;
})

This is also very important, as you have to add a catch to your fetch to check and handle errors.

app.ts Outdated
Comment on lines 29 to 30
HEADERS = await fetch('/columns')
.then(resp => resp.json());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above, but about HEADERS

app.ts Outdated


// Fetch headers and record count
async function getData() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the return type to this function. (It should be Promise<void>)

app.ts Outdated
Comment on lines 256 to 277
else if (diff > 0 && end >= RECORDCOUNT) {
let addEnd = (RECORDCOUNT - 1) - trimEnd;
end = RECORDCOUNT - 1;
start = end - addEnd + 1;
isAppend = true;
let recordsLink = "/records?from=" + start + "&to=" + end;
addRows(recordsLink);

let addTop = diff - addEnd;
end = trimStart - 1;
start = trimStart - addTop;
isAppend = false;

for (let i = end; i >= start; i--) {
let recordsLink = "/records?from=" + i + "&to=" + i;
await addRows(recordsLink);
}

trimEnd = RECORDCOUNT - 1;
trimStart = trimStart - addTop;
records = newHeight;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should change the check for the previous if to also catch this case and remove this one, they will both have the same result.

app.ts Outdated
trimStart = trimStart - addTop;
records = newHeight;
}
else if (diff > 0 && start <= RECORDCOUNT - 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put the else on the same line as the }

app.ts Outdated
records = newHeight;
}
else {
records = newHeight;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seem to be doing this in every if or else. You should move it to after the ifs, then you can remove it from each if

app.ts Outdated
Comment on lines 306 to 307
}, 100)
); // Log window dimensions at most every 100ms
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same line comment

app.ts Outdated
Comment on lines 286 to 287
}
else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please put this else on the same line as the }

Copy link
Contributor

@FritzOnFire FritzOnFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really appreciate the extra detail you put into all of the css, she is not an easy one to master.

You seem to be focusing alot on making tiny calls to the back-end, but what you should be focusing on is making as few calls as possible (with-out fetching everything of coarse). Rather figure out before hand what all the rows are that you need, and only do one call per user input (obviously this becomes even less with your debouncing)

index.html Outdated
<h1>IMQS Onboarding Project</h1>
</div>
<div class="constrols-search">
<button class="search-btn" onclick="searchFunction()">Search ID</button>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not specify the onclick here, this should be done in your typescript code.

index.html Outdated
<p id="page-info" class="page-info"></p>
</div>
</div>
<script type="text/javascript" charset="utf-8" src="app.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your scripts should all be in the head tag

style.css Outdated
@@ -0,0 +1,197 @@

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line.

style.css Outdated
.controls {
display: flex;
text-overflow: clip;
white-space: nowrap;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the spaces to tabs here. (You can add "editor.renderWhitespace": "all", to your vscode settings to catch stuff like this.)

style.css Outdated
border: solid 1px #cae00d;
}


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line.

style.css Outdated
text-overflow: clip;
white-space: nowrap;
background-color: #16191e;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line.

style.css Outdated

}

/* Page n underneath table */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are missing a few letters here. (or you have to many?)

style.css Outdated

/* Pagination buttons */
.pagination-wrapper {
width: 70%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the spaces here.

style.css Outdated
}

.btn {
color: #fdfdfd;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment about the spaces here.

Comment on lines +169 to +197
.loader {
height: 100vh;
width: 100vw;
overflow: hidden;
background-color: #16191e;
/* position: absolute; */
align-items: center;
}

.loader>div{
height: 6rem;
width: 6rem;
border: 15px solid #45474b;
border-top-color: #cae00d;
position: absolute;
margin: auto;
top: 0;
bottom: 0;
left: 0;
right: 0;
border-radius: 50%;
animation: spin 1.5s infinite linear;
}

@keyframes spin {
100%{
transform: rotate(360deg);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very awesome! Great to see the extra effort :)

Copy link
Contributor

@FritzOnFire FritzOnFire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small comments, and questions, you can make the changes if you want, but I would say you are done :)

if (resp == true) {
state.loadIntoTable(true);
}
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ;

@@ -0,0 +1,384 @@
"use strict";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add your js files to your gitignore. (But make sure that jquery is still included)

@@ -0,0 +1 @@
{"version":3,"file":"state.js","sourceRoot":"","sources":["state.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA6C;AAC7C,IAAM,QAAQ,GAAG,UAAC,EAAY,EAAE,EAAU;IACzC,IAAI,SAAwC,CAAC;IAC7C,OAAO;QAAA,iBAGN;QAH2B,cAAc;aAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;YAAd,yBAAc;;QACzC,YAAY,CAAC,SAAS,CAAC,CAAC;QACxB,S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ACvC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;;;wBACnC,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE;4BAC1D,6CAA6C;4BAC7C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;4BAEzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;yBACnC;;;wBACD,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;wBAEzB,iCAAiC;wBACjC,MAAA,IAAI,CAAC,QAAQ,0CAAE,eAAe,CAAC,UAAU,CAAC,CAAC;wBAC3C,MAAA,IAAI,CAAC,OAAO,0CAAE,eAAe,CAAC,UAAU,CAAC,CAAC;wBAC1C,MAAA,IAAI,CAAC,OAAO,0CAAE,eAAe,CAAC,UAAU,CAAC,CAAC;wBAC1C,MAAA,IAAI,CAAC,OAAO,0CAAE,eAAe,CAAC,UAAU,CAAC,CAAC;wBAE1C,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,GAAG,CAAC,EAAE;4BAC9C,MAAA,IAAI,CAAC,OAAO,0CAAE,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;4BACnD,MAAA,IAAI,CAAC,OAAO,0CAAE,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;yBACnD;wBAED,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,EAAE;4BACxB,MAAA,IAAI,CAAC,QAAQ,0CAAE,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;4BACpD,MAAA,IAAI,CAAC,OAAO,0CAAE,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;yBACnD;;;;;KACD;IACF,YAAC;AAAD,CAAC,AA9VD,IA8VC"} No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add your .js.map files to your gitignore

console.error(error);
});

return true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch :)

// Prepend rows as last page gets bigger
end = this.getRecordCount() - 1;
start = end - (newHeight - 1);
console.log("End reached, displaying record ", start, " to ", end);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove stray console log

Comment on lines +160 to +161
.then(count => {
this.data = count;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this should be called count

start = end - (newHeight - 1);
console.log("End reached, displaying record ", start, " to ", end);

await this.addRows(start, end);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does only this addRows have an await?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants