Skip to content

Commit

Permalink
improve editor page
Browse files Browse the repository at this point in the history
* allow uppercase file extensions fixes #60
  • Loading branch information
ananthakumaran committed Sep 30, 2023
1 parent 374b48e commit c00a854
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 13 deletions.
13 changes: 11 additions & 2 deletions src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ $menu-item-hover-background-color: $link-light;
$menu-item-active-color: $link-dark;
$menu-item-active-background-color: $link-light;

$editor-full-height: calc(100vh - 21px - 57.75px - 10.5px);

@import "bulma/bulma.sass";
@import "bulma-switch/src/sass/index.sass";
@import "@cityssm/bulma-sticky-table/sticky-table";
Expand Down Expand Up @@ -56,7 +58,7 @@ $menu-item-active-background-color: $link-light;

a.du-active {
color: $link !important;
background-color: $white-ter !important;
background-color: $white !important;
font-weight: bold;
}
}
Expand Down Expand Up @@ -393,6 +395,8 @@ nav.level.grid-2 {
background-color: $white-ter;
color: $grey-light;
border: none;
border-top-left-radius: $radius-small;
border-bottom-left-radius: $radius-small;
}

.cm-activeLineGutter {
Expand Down Expand Up @@ -557,9 +561,14 @@ nav.level.grid-2 {
width: 800px;
}

.full-height {
max-height: $editor-full-height;
}

.editor .cm-editor {
max-height: calc(100vh - 185px);
max-height: $editor-full-height;
}

.cm-scroller {
overflow: auto;
font-family: $family-monospace !important;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/FileTree.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<span class="icon is-small">
<i class="fa-regular fa-file-lines" />
</span>
{fileName(file.name)}
<span title={fileName(file.name)} class="truncate">{fileName(file.name)}</span>
{#if file.name == selectedFileName && hasUnsavedChanges}
<span class="ml-1 tag is-danger">unsaved</span>
{/if}
Expand All @@ -39,7 +39,7 @@
<span class="icon is-small">
<i class="fa-regular fa-folder" />
</span>
{file.name}
<span title={file.name} class="truncate">{file.name}</span>
</summary>
<svelte:self
on:select={(e) => dispatch("select", e.detail)}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/sheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ interface Result {
}

export function parse(file: File): Promise<Result> {
const extension = file.name.split(".").pop();
let extension = file.name.split(".").pop();
extension = extension?.toLowerCase();
if (extension === "csv" || extension === "txt") {
return parseCSV(file);
} else if (extension === "xlsx" || extension === "xls") {
Expand Down
12 changes: 6 additions & 6 deletions src/routes/ledger/editor/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@

<FileModal bind:open={modalOpen} on:save={(e) => createFile(e.detail)} label="Create" help="" />

<section class="section tab-editor" style="padding-bottom: 0 !important">
<section class="section tab-editor max-h-screen" style="padding-bottom: 0 !important">
<div class="container is-fluid">
<div class="columuns">
<div class="column is-12 px-0 pt-0 mb-2">
Expand Down Expand Up @@ -299,9 +299,9 @@
</div>
</div>
<div class="columns">
<div class="column is-2">
<div class="column is-3-widescreen is-2-fullhd is-4">
<div class="box px-2">
<aside class="menu" style="max-height: calc(100vh - 185px)">
<aside class="menu full-height">
<FileTree
on:select={(e) => selectFile(e.detail)}
files={buildLedgerTree(_.values(filesMap))}
Expand All @@ -311,14 +311,14 @@
</aside>
</div>
</div>
<div class="column is-6">
<div class="column is-6-widescreen is-6-fullhd is-8">
<div class="box py-0">
<div class="editor" bind:this={editorDom} />
</div>
</div>
<div class="column is-4">
<div class="column is-3-widescreen is-4-fullhd is-hidden-touch is-hidden-desktop-only">
{#if !_.isEmpty($editorState.output)}
<pre style="max-height: calc(100vh - 185px)">{$editorState.output}</pre>
<pre class="box px-3 full-height">{$editorState.output}</pre>
{/if}
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions src/routes/ledger/import/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
<Dropzone
multiple={false}
inputElement={input}
accept=".csv,.txt,.xls,.xlsx,.pdf"
accept=".csv,.txt,.xls,.xlsx,.pdf,.CSV,.TXT,.XLS,.XLSX,.PDF"
on:drop={handleFilesSelect}
>
Drag 'n' drop CSV, TXT, XLS, XLSX, PDF file here or click to select
Expand Down Expand Up @@ -320,6 +320,8 @@
<style lang="scss">
@import "bulma/sass/utilities/_all.sass";
$import-full-height: calc(100vh - 205px);
.clipboard {
float: right;
position: absolute;
Expand All @@ -337,6 +339,6 @@
.table-wrapper {
overflow-x: auto;
overflow-y: auto;
max-height: calc(100vh - 225px);
max-height: $import-full-height;
}
</style>

0 comments on commit c00a854

Please sign in to comment.