Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Pretier rules and update #2

Merged
merged 1 commit into from
Nov 23, 2023
Merged
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
12 changes: 11 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
{
"plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte",
"semi": true,
"tabWidth": 2,
"singleQuote": true
}
}
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@typescript-eslint/parser": "^6.12.0",
"eslint": "^8.54.0",
"eslint-plugin-svelte": "^2.35.1",
"prettier": "^2.8.8",
"prettier": "^3.1.0",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^3.59.2",
"svelte-atoms": "^0.0.27",
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
dimension: get(dimensionColumn),
indicator: get(indicatorColumn),
},
{ offset: get(rowOffset) }
{ offset: get(rowOffset) },
);
}, 100);
};
Expand Down
102 changes: 50 additions & 52 deletions src/lib/Input/Download.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,70 +31,68 @@
dimension: $dimensionColumn,
indicator: $indicatorColumn,
},
{ offset: $rowOffset }
{ offset: $rowOffset },
);
switch ($selectedFormat.toLocaleLowerCase()) {
case 'csv':{
const CSVString = exportToCSV(sheet, { lang: $langOutput});
case 'csv': {
const CSVString = exportToCSV(sheet, { lang: $langOutput });

const blob = new Blob([CSVString], { type: 'text/csv;charset=utf-8,' });
const objUrl = URL.createObjectURL(blob);
const blob = new Blob([CSVString], { type: 'text/csv;charset=utf-8,' });
const objUrl = URL.createObjectURL(blob);

linkFile.href = objUrl;
console.log(fileName);
linkFile.download = fileName + ' - ' + $langOutput;
linkFile.click();
break;
}
case 'pdf':{
window.print();
break;
}
case 'qti':
{
const lang = $langOutput;
const { manifest, questionsManifest } = exportToQTI(sheet, {
lang,
});
linkFile.href = objUrl;
console.log(fileName);
linkFile.download = fileName + ' - ' + $langOutput;
linkFile.click();
break;
}
case 'pdf': {
window.print();
break;
}
case 'qti': {
const lang = $langOutput;
const { manifest, questionsManifest } = exportToQTI(sheet, {
lang,
});

const manifestBlob = new Blob([manifest.toString()], {
type: 'text/xml',
});
const questionsManifestBlob = questionsManifest.map(
(q) => new Blob([q.toString()], { type: 'text/xml' })
);
const manifestBlob = new Blob([manifest.toString()], {
type: 'text/xml',
});
const questionsManifestBlob = questionsManifest.map(
(q) => new Blob([q.toString()], { type: 'text/xml' }),
);

const ex = async () => {
const zipFileStream = new TransformStream();
const zipFileBlobPromise = new Response(
zipFileStream.readable
).blob();
const ex = async () => {
const zipFileStream = new TransformStream();
const zipFileBlobPromise = new Response(
zipFileStream.readable,
).blob();

const zipWriter = new ZipWriter(new BlobWriter('application/zip'));
const zipWriter = new ZipWriter(new BlobWriter('application/zip'));

// Create manifest xml file
await zipWriter.add('imsmanifest.xml', new BlobReader(manifestBlob));
// Create manifest xml file
await zipWriter.add('imsmanifest.xml', new BlobReader(manifestBlob));

await Promise.all(
questionsManifestBlob.map((b, n) =>
zipWriter.add(`items/${n}/qti.xml`, new BlobReader(b))
)
);
await Promise.all(
questionsManifestBlob.map((b, n) =>
zipWriter.add(`items/${n}/qti.xml`, new BlobReader(b)),
),
);

const finalBlob = await zipWriter.close();
const finalBlob = await zipWriter.close();

linkFile.setAttribute('href', URL.createObjectURL(finalBlob));
linkFile.download = fileName + '.zip';
linkFile.click();
};
ex();
linkFile.setAttribute('href', URL.createObjectURL(finalBlob));
linkFile.download = fileName + '.zip';
linkFile.click();
};
ex();

break;
}
default:
{
console.log('Not unsuported yet');
}
break;
}
default: {
console.log('Not unsuported yet');
}
}
};
</script>
Expand Down
1 change: 0 additions & 1 deletion src/lib/Input/DropZone.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

// Restore options
currentSheet.update(() => undefined);


const data = await fileTemp.arrayBuffer();
/* data is an ArrayBuffer */
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Input/LetterPicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
cursor: pointer;
}
button:hover{
button:hover {
filter: invert(0.5);
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/menu/Column.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
flex-wrap: wrap;
align-items: center;
}
.line{
.line {
background-color: #00566b;
width: 2px;
}
Expand Down
7 changes: 3 additions & 4 deletions src/lib/preview/PreviewTAO.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

export let QCMs: QCM[] = [];
export let hideAnswer: boolean;

</script>

<div class="questions" bind:this={$TaoPreviewBind}>
Expand All @@ -19,7 +18,7 @@
</div>
<div class="prompt">
<br />
<!-- eslint-disable svelte/no-at-html-tags -->
<!-- eslint-disable svelte/no-at-html-tags -->
{@html QCM.prompt}
<!--eslint-enable-->
<br />
Expand All @@ -33,7 +32,7 @@
}`}
>
<div class="text">
<!-- eslint-disable svelte/no-at-html-tags -->
<!-- eslint-disable svelte/no-at-html-tags -->
{@html answer.prompt}
<!--eslint-enable-->
</div>
Expand All @@ -49,7 +48,7 @@

<style>
.question {
font-family: "Source Sans Pro";
font-family: 'Source Sans Pro';
display: flex;
flex-direction: column;
border: 3px solid #007f9f;
Expand Down
Loading