-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from ls1intum/3-problem-statement
Display Problem Statement in iframe
- Loading branch information
Showing
21 changed files
with
871 additions
and
324 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
html { | ||
box-sizing: border-box; | ||
font-size: 13px; | ||
} | ||
|
||
*, | ||
*:before, | ||
*:after { | ||
box-sizing: inherit; | ||
} | ||
|
||
body, | ||
h1, | ||
h2, | ||
h3, | ||
h4, | ||
h5, | ||
h6, | ||
p, | ||
ol, | ||
ul { | ||
margin: 0; | ||
padding: 0; | ||
font-weight: normal; | ||
} | ||
|
||
img { | ||
max-width: 100%; | ||
height: auto; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
:root { | ||
--container-padding: 20px; | ||
--input-padding-vertical: 6px; | ||
--input-padding-horizontal: 4px; | ||
--input-margin-vertical: 4px; | ||
--input-margin-horizontal: 0; | ||
} | ||
|
||
body { | ||
padding: 0 var(--container-padding); | ||
color: var(--vscode-foreground); | ||
font-size: var(--vscode-font-size); | ||
font-weight: var(--vscode-font-weight); | ||
font-family: var(--vscode-font-family); | ||
background-color: var(--vscode-editor-background); | ||
} | ||
|
||
ol, | ||
ul { | ||
padding-left: var(--container-padding); | ||
} | ||
|
||
body > *, | ||
form > * { | ||
margin-block-start: var(--input-margin-vertical); | ||
margin-block-end: var(--input-margin-vertical); | ||
} | ||
|
||
*:focus { | ||
outline-color: var(--vscode-focusBorder) !important; | ||
} | ||
|
||
a { | ||
color: var(--vscode-textLink-foreground); | ||
} | ||
|
||
a:hover, | ||
a:active { | ||
color: var(--vscode-textLink-activeForeground); | ||
} | ||
|
||
code { | ||
font-size: var(--vscode-editor-font-size); | ||
font-family: var(--vscode-editor-font-family); | ||
} | ||
|
||
button { | ||
border: none; | ||
padding: var(--input-padding-vertical) var(--input-padding-horizontal); | ||
width: 100%; | ||
text-align: center; | ||
outline: 1px solid transparent; | ||
outline-offset: 2px !important; | ||
color: var(--vscode-button-foreground); | ||
background: var(--vscode-button-background); | ||
} | ||
|
||
button:hover { | ||
cursor: pointer; | ||
background: var(--vscode-button-hoverBackground); | ||
} | ||
|
||
button:focus { | ||
outline-color: var(--vscode-focusBorder); | ||
} | ||
|
||
button.secondary { | ||
color: var(--vscode-button-secondaryForeground); | ||
background: var(--vscode-button-secondaryBackground); | ||
} | ||
|
||
button.secondary:hover { | ||
background: var(--vscode-button-secondaryHoverBackground); | ||
} | ||
|
||
input:not([type='checkbox']), | ||
textarea { | ||
display: block; | ||
width: 100%; | ||
border: none; | ||
font-family: var(--vscode-font-family); | ||
padding: var(--input-padding-vertical) var(--input-padding-horizontal); | ||
color: var(--vscode-input-foreground); | ||
outline-color: var(--vscode-input-border); | ||
background-color: var(--vscode-input-background); | ||
} | ||
|
||
input::placeholder, | ||
textarea::placeholder { | ||
color: var(--vscode-input-placeholderForeground); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
import * as vscode from 'vscode'; | ||
|
||
export const settings_base_url: string | undefined= vscode.workspace.getConfiguration('scorpio').get('apiBaseUrl'); | ||
export const settings_user: string | undefined = vscode.workspace.getConfiguration('scorpio').get('userData.username'); | ||
export const settings_password: string | undefined = vscode.workspace.getConfiguration('scorpio').get('userData.password'); | ||
type Settings = { | ||
base_url: string | undefined, | ||
client_url: string | undefined, | ||
user: string | undefined, | ||
password: string | undefined | ||
|
||
} | ||
export const settings: Settings = { | ||
base_url: vscode.workspace.getConfiguration('scorpio').get('apiBaseUrl'), | ||
client_url: vscode.workspace.getConfiguration('scorpio').get('clientBaseUrl'), | ||
user: vscode.workspace.getConfiguration('scorpio').get('userData.username'), | ||
password: vscode.workspace.getConfiguration('scorpio').get('userData.password') | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as vscode from 'vscode'; | ||
import { fetch_courses } from "./course_api"; | ||
import { Course } from './course_model'; | ||
|
||
export type CourseOption = { | ||
label: string; | ||
description: string; | ||
course: Course; | ||
}; | ||
|
||
export async function build_course_options() { | ||
let courses; | ||
try { | ||
courses = await fetch_courses(); | ||
} catch (e) { | ||
vscode.window.showErrorMessage(`error: ${e}`); | ||
return; | ||
} | ||
|
||
const courseOptions: CourseOption[] = courses.map(course => ({ | ||
label: course.title, // Adjust based on your data structure | ||
description: course.description, // Adjust based on your data structure | ||
course: course, // Use a unique identifier | ||
})); | ||
|
||
return courseOptions; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export type Course = { | ||
id: string; | ||
title: string; | ||
description: string; | ||
shortName: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import * as vscode from 'vscode'; | ||
import { fetch_exercise } from './exercise_api'; | ||
import { CourseOption } from '../course/course'; | ||
import { set_current } from '../shared_model'; | ||
|
||
export async function build_exercise_options(courseOptions: CourseOption[] | undefined) { | ||
if (!courseOptions) { | ||
return; | ||
} | ||
|
||
const selectedCourse = await vscode.window.showQuickPick(courseOptions, { | ||
placeHolder: 'Select an item', | ||
}); | ||
if (!selectedCourse) { | ||
vscode.window.showErrorMessage('No course was selected'); | ||
return; | ||
} | ||
|
||
let exercises; | ||
try { | ||
exercises = await fetch_exercise(selectedCourse.course.id); | ||
} catch (e) { | ||
vscode.window.showErrorMessage(`error: ${e}`); | ||
return; | ||
} | ||
const exerciseOptions = exercises.map(exercise => ({ | ||
label: exercise.title, // Adjust based on your data structure | ||
description: "", // Adjust based on your data structure | ||
exercise: exercise, // Use a unique identifier | ||
})); | ||
const selectedExercise = await vscode.window.showQuickPick(exerciseOptions, { | ||
placeHolder: 'Select an item', | ||
}); | ||
if (!selectedExercise) { | ||
vscode.window.showErrorMessage('No exercise was selected'); | ||
return; | ||
} | ||
|
||
// set current course here so that if an error occurs before the previous exercise and course are still set | ||
set_current(selectedCourse.course, selectedExercise.exercise); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export type Exercise = { | ||
type: string, | ||
id: number, | ||
title: string, | ||
shortName: string | ||
problemStatement: string | ||
} |
Oops, something went wrong.