Skip to content

Commit 0961586

Browse files
authored
Merge pull request #72 from etinaude/adminUI
Admin UI
2 parents ec8237e + 37374a0 commit 0961586

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

src/routes/admin/addMedia.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
6767
returnedFilePath = await addNewImage(blob, fileName);
6868
if (returnedFilePath == '') return banner.show('Error Uploading', 'error');
69+
returnedFilePath = returnedFilePath.replace(/ /g, '%20');
70+
returnedFilePath = returnedFilePath.replace('projects/', 'projects%2F');
71+
returnedFilePath = returnedFilePath.replace('logos/', 'projlogosetcs%2F');
72+
returnedFilePath = returnedFilePath.replace('awards/', 'awards%2F');
73+
74+
console.log(returnedFilePath);
6975
7076
banner.show('File Uploaded', 'success');
7177
}

src/routes/admin/editProject.svelte

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import { tagOptions } from '$lib/services/tags';
77
import type { ProjectT } from '$lib/types/types';
88
import { onMount } from 'svelte';
9+
import Modal from '$lib/components/project/Modal.svelte';
910
1011
let allProjects: ProjectT[] = [];
12+
let openIndex = -1;
1113
1214
let project: ProjectT = {
1315
title: '',
@@ -17,7 +19,7 @@
1719
featured: false,
1820
priority: 10,
1921
tags: [],
20-
media: []
22+
media: ['']
2123
};
2224
2325
let tag: string = '';
@@ -26,6 +28,8 @@
2628
async function submit() {
2729
banner.show('Submitting', 'info');
2830
31+
project.media = project.media.filter((l) => l !== '');
32+
2933
if (project.title === '') return banner.show('No Title', 'error');
3034
if (project.description === '') return banner.show('No Description', 'error');
3135
if (project.media.length === 0) return banner.show('No Image Url', 'error');
@@ -72,6 +76,8 @@
7276
</script>
7377

7478
<section>
79+
<Modal projectsList={[project]} projectIndex={openIndex} />
80+
7581
<div class="row">
7682
<div class="column demo">
7783
<h2>Search project</h2>
@@ -90,7 +96,7 @@
9096

9197
<div class="center">
9298
<div class="tiles">
93-
<Tile cardData={project} />
99+
<Tile cardData={project} index={0} bind:openIndex />
94100
</div>
95101
</div>
96102
</div>
@@ -103,11 +109,6 @@
103109
<input type="text" id="title" name="title" bind:value={project.title} />
104110
</div>
105111

106-
<div class="field">
107-
<label for="tldr">TLDR</label>
108-
<textarea id="tldr" name="tldr" rows="3" bind:value={project.tldr} />
109-
</div>
110-
111112
<div class="field">
112113
<label for="description">Description</label>
113114
<textarea id="description" name="description" rows="7" bind:value={project.description} />
@@ -116,21 +117,20 @@
116117
<h3>Optional</h3>
117118

118119
<div class="field">
119-
<label for="followUrl">Follow Url</label>
120-
<input type="text" id="followUrl" name="followUrl" bind:value={project.followUrl} />
120+
<label for="tldr">TLDR</label>
121+
<textarea id="tldr" name="tldr" rows="3" bind:value={project.tldr} />
121122
</div>
122123

123124
<div class="field">
125+
<label for="followUrl">Follow Url</label>
126+
<input type="text" id="followUrl" name="followUrl" bind:value={project.followUrl} />
124127
<label for="featured">Featured</label>
125128
<input type="checkbox" id="featured" name="featured" bind:checked={project.featured} />
126129
</div>
127130

128131
<div class="field">
129132
<label for="priority">Priority</label>
130133
<input type="number" id="priority" name="priority" bind:value={project.priority} />
131-
</div>
132-
133-
<div class="field">
134134
<label for="tags">tags</label>
135135
<select name="tags" id="tags" bind:value={tag} on:change={addTag}>
136136
{#each tagOptions as tagOptionItem}
@@ -153,7 +153,7 @@
153153
{/if}
154154

155155
<div class="extra-media">
156-
<h3>Extra Media</h3>
156+
<h3>Media URLs</h3>
157157
{#each project.media as link}
158158
<div class="field">
159159
<input type="text" id="media" name="media" bind:value={link} />

src/routes/projects/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<Header />
5959

6060
<section>
61-
<Modal projectsList={allProjects} projectIndex={openIndex} />
61+
<Modal projectsList={smallProjects} projectIndex={openIndex} />
6262

6363
<Saos animation={'from-bottom 1s ease'}>
6464
<h2 class="featured-title">Featured Projects</h2>

0 commit comments

Comments
 (0)