Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6affe4b

Browse files
db/feat: Add solutions, tags and companies
1 parent 4b06f9c commit 6affe4b

File tree

10 files changed

+5607
-1583
lines changed

10 files changed

+5607
-1583
lines changed

‎components/ContributeButton.js

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,21 @@ class ContributeButton extends ShadowComponent {
1010
<style>
1111
a {
1212
display: inline;
13-
}
14-
15-
#contribute {
1613
background: #2ea44e;
17-
border-radius: 1.5rem;
18-
padding: .375rem .85rem;
19-
font-size: 1rem;
20-
border: none;
2114
cursor: pointer;
15+
padding: 4px 8px;
16+
border-radius: 4px;
17+
font-size: 12px;
18+
font-weight: bold;
2219
color: white;
20+
text-decoration: none;
2321
}
2422
25-
#contribute:hover {
23+
a:hover {
2624
background: rgb(70, 180, 94);
2725
}
28-
29-
#contribute>span {
30-
font-size: 1.25rem;
31-
font-weight: 700;
32-
}
3326
</style>
34-
<a href="https://github.com/LeetStream/leetstream.github.io">
35-
<button id="contribute">
36-
<span>+</span> Contribute
37-
</button>
38-
</a>
27+
<a href="https://github.com/LeetStream/leetstream.github.io">+</a>
3928
`;
4029
}
4130
}

‎components/Done.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Done extends Component {
1212
const solutions = todaysProblem.solutions;
1313
return /*HTML*/ `
1414
<confettiful-comp>
15-
<div >
15+
<div class="references">
1616
<div class="patterns">
1717
${patterns
1818
.map((pattern) => {
@@ -67,6 +67,14 @@ class Done extends Component {
6767
</span>
6868
</div>
6969
</div>
70+
71+
<div class="badges">
72+
${todaysProblem.tags
73+
.map((tag) => {
74+
return /*HTML*/ `<span class="badge" style="background-color: #a52a2a;">${tag}</span>`;
75+
})
76+
.join("")}
77+
</div>
7078
</confettiful-comp>
7179
`;
7280
}

‎components/ProblemForm.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ class ProblemForm extends Component {
2727

2828
const companiesList = this.querySelector("#companies");
2929

30-
problem.companies.reverse().forEach((com) => {
31-
const listItem = this.createElement("li");
32-
listItem.innerHTML = com;
30+
problem.companies.reverse().forEach((val) => {
31+
const listItem = document.createElement("li");
32+
listItem.classList.add("badge");
33+
listItem.style.backgroundColor = "#dc143c";
34+
listItem.innerText = val;
3335
companiesList.insertBefore(listItem, companiesList.firstChild);
3436
});
3537

@@ -68,8 +70,8 @@ class ProblemForm extends Component {
6870
stored.maxBugs = Math.max(stored.maxBugs, bugsValue);
6971
stored.maxHints = Math.max(stored.maxHints, hintsValue);
7072

71-
stored.problems.forEach(
72-
(p) =>
73+
Object.entries(stored.problems).forEach(
74+
(ki,p) =>
7375
(p.score = calculateScore(
7476
stored.maxBugs,
7577
stored.maxHints,
@@ -80,8 +82,7 @@ class ProblemForm extends Component {
8082
))
8183
);
8284
}
83-
stored.problems.push({
84-
index: problemOfDay,
85+
stored.problems[problem.id] = {
8586
hints: +hints.value,
8687
bugs: +bugs.value,
8788
time: +time.value,
@@ -96,7 +97,7 @@ class ProblemForm extends Component {
9697
),
9798
solutionUrl: solutionUrl.value,
9899
note: note.value,
99-
});
100+
};
100101
UserDb.set(stored);
101102
location.hash = "done";
102103
});

‎db/companies.js

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /