Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/modules/Challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export default class Challenge {
data: challengeData,
};

const timerHtml = await ejs.renderFile(`${process.env.ROOT_DIR}/templates/timer.ejs`);
challengeData.timerUI = timerHtml;

const challengeTemplatePath = `${process.env.ROOT_DIR}/templates/challenge.ejs`;
const challengeHtml = await ejs.renderFile(
challengeTemplatePath,
Expand Down Expand Up @@ -105,6 +108,9 @@ export default class Challenge {
case "submit":
await Challenge.executeCode(this.challenges[challengeSlug], "submit");
break;
case "time_up":
vscode.window.showErrorMessage("🕓 Time's up!");
break;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/modules/Hackerrank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ export default class Hackerrank {
authorName: responseData.model.author_name,
authorAvatar: responseData.model.author_avatar,
languagesBoilerplate: {},
timerUI: ""
};

for (let lang of responseData.model.languages) {
Expand Down
1 change: 1 addition & 0 deletions src/modules/interface/Challenge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export default interface IChallenge {
authorName: string;
authorAvatar: string;
languagesBoilerplate: Record<string, string>;
timerUI: string;
}
11 changes: 11 additions & 0 deletions src/templates/challenge.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
clear: both;
}
.solve {
float: left;
background-color: #00ea64;
}
.run {
Expand All @@ -69,6 +70,7 @@
.submit {
float: right;
background-color: #00ea64;
margin-right: 10px;
}
</style>
</head>
Expand All @@ -80,7 +82,16 @@
Submit
</button>
<button id="run" class="btn run" onclick="execute('run')">Run</button>
<button id="timer-icon" title="Timer">⏲</button>

<div id="timer-bar">
<span id="pause-timer" title="Pause">❚❚</span>
<span id="timer-display">00:00:00</span>
<span id="reset-timer" title="Reset">↻</span>
<span id="collapse-timer" title="Hide">≫</span>
</div>
</div>
<%- timerUI %>
<%- questionHtml %>
<script>
let openCodeEditorsCount = 0;
Expand Down
Loading