New
diff --git a/PlayingCard.cs b/PlayingCard.cs
new file mode 100644
index 0000000..36dab8a
--- /dev/null
+++ b/PlayingCard.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+
+namespace PaperMiniMaker {
+
+public class PlayingCard {
+ public int Replicas {get; set;} = 1;
+ public string FrontUrl {get; set;}
+ public string BackUrl {get; set;}
+}
+
+}
\ No newline at end of file
diff --git a/Shared/BulkLoader.razor b/Shared/BulkLoader.razor
new file mode 100644
index 0000000..31c1769
--- /dev/null
+++ b/Shared/BulkLoader.razor
@@ -0,0 +1,75 @@
+@inject IJSRuntime js;
+
+
+
+
+
+
Select any number of image files below to create miniatures for.
+
+
+
+
+
+
+@code {
+
+ private bool isOpen = false;
+ private string showModalCss => isOpen ? "w3-show" : "w3-hide";
+
+ private ElementReference files;
+
+ private BulkResults dataUrls;
+
+ [Parameter] public Action
> OnChange {get; set;}
+
+ private class BulkResults {
+ public string[] dataUrls {get; set;}
+ public string[] names {get; set;}
+ }
+
+ private async Task readFileStrings() {
+ dataUrls = await js.InvokeAsync("BlazorHandleFileSelectMultipleDataUrl", files);
+ }
+
+ public void Show(bool isOpen) {
+ this.isOpen = isOpen;
+ StateHasChanged();
+ }
+
+ private void save() {
+ if (OnChange == null)
+ return;
+
+ if (dataUrls == null || dataUrls.dataUrls == null) {
+ OnChange(new Mini[0]);
+ Show(false);
+ return;
+ }
+
+ var minis = new Mini[this.dataUrls.dataUrls.Length];
+ for (var i = 0; i < minis.Length; i++) {
+ minis[i] = new Mini {
+ Name = i >= 0 && dataUrls.names != null && i < dataUrls.names.Length ? dataUrls.names[i] : "Bulk Mini",
+ Size = MiniSize.Medium,
+ FrontArt = new MiniArt {
+ Url = dataUrls.dataUrls[i]
+ },
+ Replicas = 1,
+ };
+ }
+ OnChange(minis);
+ Show(false);
+ }
+}
\ No newline at end of file
diff --git a/Shared/CardEditor.razor b/Shared/CardEditor.razor
new file mode 100644
index 0000000..4f90bb7
--- /dev/null
+++ b/Shared/CardEditor.razor
@@ -0,0 +1,55 @@
+
+
+
+ @if (card != null) {
+
+
+
+
+
+
+
+
+
+ OR
+
+
{ card.FrontUrl = url; StateHasChanged(); })>
+
+
+
+
+
+
+ OR
+
+
{ card.BackUrl = url; StateHasChanged(); })>
+
+
+
+
+ }
+
+
+
+@code {
+ [Parameter] public Action OnChange {get; set;}
+ private PlayingCard card;
+
+ private bool isOpen = false;
+ private string showModalCss => isOpen ? "w3-show" : "w3-hide";
+
+ public void Edit(PlayingCard card) {
+ this.card = card;
+ this.isOpen = true;
+ StateHasChanged();
+ }
+
+ public void save() {
+ OnChange?.Invoke();
+ this.isOpen = false;
+ }
+}
\ No newline at end of file
diff --git a/Shared/MainLayout.razor b/Shared/MainLayout.razor
index 4c520ed..f326403 100644
--- a/Shared/MainLayout.razor
+++ b/Shared/MainLayout.razor
@@ -13,6 +13,9 @@
Terrain
+
+ Card
+
@Body
diff --git a/Shared/PopupModal.razor b/Shared/PopupModal.razor
new file mode 100644
index 0000000..27292c6
--- /dev/null
+++ b/Shared/PopupModal.razor
@@ -0,0 +1,31 @@
+
+
+
+ @Title Show(false))>x
+
+
+ @ChildContent
+
+
+
+
+
+@code {
+ [Parameter] public string Title {get; set;}
+ [Parameter] public RenderFragment ChildContent {get; set;}
+ [Parameter] public Action OnSave {get; set;}
+
+ private bool isOpen = false;
+ private string showModalCss => isOpen ? "w3-show" : "w3-hide";
+ public void Show(bool isOpen) {
+ this.isOpen = isOpen;
+ StateHasChanged();
+ }
+ private void save() {
+ if (OnSave != null)
+ OnSave();
+ Show(false);
+ }
+}
\ No newline at end of file
diff --git a/wwwroot/assets/card.svg b/wwwroot/assets/card.svg
new file mode 100644
index 0000000..8bdc8db
--- /dev/null
+++ b/wwwroot/assets/card.svg
@@ -0,0 +1,158 @@
+
+
diff --git a/wwwroot/assets/printer.svg b/wwwroot/assets/printer.svg
new file mode 100644
index 0000000..ebf1ead
--- /dev/null
+++ b/wwwroot/assets/printer.svg
@@ -0,0 +1,108 @@
+
+
diff --git a/wwwroot/assets/scale.svg b/wwwroot/assets/scale.svg
new file mode 100644
index 0000000..28c6399
--- /dev/null
+++ b/wwwroot/assets/scale.svg
@@ -0,0 +1,72 @@
+
+
diff --git a/wwwroot/css/app.css b/wwwroot/css/app.css
index a2c9efe..74d2143 100644
--- a/wwwroot/css/app.css
+++ b/wwwroot/css/app.css
@@ -22,6 +22,11 @@ header {
z-index: 10;
}
+nav {
+ background-color: #1f1c35;
+ padding: 4px;
+}
+
footer {
background-color: #2E294E;
}
diff --git a/wwwroot/css/playing-card.css b/wwwroot/css/playing-card.css
new file mode 100644
index 0000000..1c30ff0
--- /dev/null
+++ b/wwwroot/css/playing-card.css
@@ -0,0 +1,37 @@
+.card {
+ width: 2.5in;
+ height: 3.5in;
+ border: 1px solid black;
+ display: inline-block;
+ object-fit: fill;
+}
+
+.card.poker {
+ width: 2.5in !important;
+ height: 3.5in !important;
+}
+
+.card.bridge {
+ width: 2.25in !important;
+ height: 3.5in !important;
+}
+
+.card.tarot {
+ width: 3.5in !important;
+ height: 5.75in !important;
+}
+
+.card.square {
+ width: 3.5in !important;
+ height: 3.5in !important;
+}
+
+.card.game {
+ width: 2.2in !important;
+ height: 3.43in !important;
+}
+
+.card.business {
+ width: 2in !important;
+ height: 3.5in !important;
+}
\ No newline at end of file
diff --git a/wwwroot/index.html b/wwwroot/index.html
index 66c26b9..4dc71e2 100644
--- a/wwwroot/index.html
+++ b/wwwroot/index.html
@@ -15,6 +15,7 @@
+
diff --git a/wwwroot/js/helpers.js b/wwwroot/js/helpers.js
index 52cb1ed..fa2b8ff 100644
--- a/wwwroot/js/helpers.js
+++ b/wwwroot/js/helpers.js
@@ -89,6 +89,31 @@ async function BlazorHandleFileSelectDataUrl(input) {
}
}
+function removeExtension(filename) {
+ return filename.substring(0, filename.lastIndexOf('.')) || filename;
+}
+
+async function BlazorHandleFileSelectMultipleDataUrl(input) {
+ var files = input.files;
+ if (files.length > 0) {
+ var data = {
+ dataUrls: [],
+ names: [],
+ };
+ for (var i = 0; i < files.length; i++) {
+ var file = files[i];
+ data.dataUrls.push(await BlazorReadFileAsDataUrl(file));
+ data.names.push(removeExtension(file.name));
+ }
+ return data;
+ } else {
+ return {
+ dataUrls: [],
+ names: [],
+ };
+ }
+}
+
async function BlazorReadFileAsDataUrl(file) {
return await new Promise((resolve, reject) => {
var reader = new FileReader();