Skip to content

Commit

Permalink
fix opened template code
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis2003 committed May 21, 2024
1 parent 56374be commit 28ced6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export interface Template {
bestand: string
}

const code = `
/*const code = `
#@param
# Schrijf in dit veld je voornaam.
Expand All @@ -65,7 +65,7 @@ bestanden=["main.py", "test.py"]
# de constante pi, nodig voor wanneer we de omtrek berekenen van het object dat de student indient.
pi=3.14159
#code...`
#code...`*/

/**
* Dialog component for managing restrictions related to file uploads.
Expand All @@ -82,6 +82,7 @@ export default function RestrictionsDialog({
const [openTextEditor, setOpenTextEditor] = useState(false)
const [openTemplateInterface, setOpenTemplateInterface] = useState(false)
const [openTemplateInUI, setOpenTemplateInUI] = useState(false)
const [code, setCode] = useState('' /*code*/) // code is currently not used
const [textFieldContent, setTextFieldContent] = useState('')
const [restrictionName, setRestrictionName] = useState('')
const [restrictionType, setRestrictionType] =
Expand Down Expand Up @@ -269,7 +270,11 @@ export default function RestrictionsDialog({
const response = await instance.get(
`/templates/${template.template_id}/template/?content=true`
)
// This textFieldContent will be used when a template is opened in textmode
setTextFieldContent(response.data.content)

// The code will be used when a template is opened in the UI
setCode(response.data.content)
if (openTemplateInUI) {
handleClickOpenTemplateInterface()
} else {
Expand Down
1 change: 1 addition & 0 deletions frontend/frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default defineConfig({
'chunk-OLZKTZWI.js?v=fff2b904',
'chunk-6ZDRAOHK.js?v=fff2b904',
'chunk-BWG3R63Q.js?v=fff2b904',
'chunk-DVKQGDAD.js?v=99d84b8c',
'@mui/material/Grid', // Exclude other MUI components as needed
],
},
Expand Down

0 comments on commit 28ced6f

Please sign in to comment.