Skip to content

Commit

Permalink
File upload overhaul
Browse files Browse the repository at this point in the history
Added features:
- User can now see physical UI elements that represent files to be uploaded.
- User can click on UI elements to remove files no longer to be uploaded.
- Files can now be added onto files to be uploaded instead of outright replacing the previous selection.
  • Loading branch information
Pa1yn-dev committed Nov 11, 2023
1 parent afb6447 commit 6387498
Show file tree
Hide file tree
Showing 14 changed files with 421 additions and 360 deletions.
23 changes: 23 additions & 0 deletions src/MailLobbyer/Data/Email.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using MailLobbyer.ContactClass;
using MailLobbyer.FileUploadClass;

namespace MailLobbyer.EmailClass;

public class Email
{
public string Subject { get; set; }
public string Body { get; set; }
public FileUpload[] Attachments { get; set; }

public Contact[] Selectedcontacts { get; set; }



public Email(string subject, string body, FileUpload[] attachments, Contact[] selectedcontacts)
{
Subject = subject;
Body = body;
Attachments = attachments;
Selectedcontacts = selectedcontacts;
}
}
23 changes: 21 additions & 2 deletions src/MailLobbyer/Pages/Email.razor
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,21 @@
</div>

<div class="custom-inputfile">
<InputFile id="inputfiles" OnChange="@FileUploadHandler" multiple />
<InputFile id="inputfiles" OnChange="@FileUploadHandler" style="display: none;" multiple />
</div>

<div class="inputfile-form">
<input type="button" class="btn btn-primary"value="Browse..." onclick="document.getElementById('inputfiles').click();" />
@foreach (var file in selectedfiles)
{
<div class="selectedfile-container">
<button type="button" id="file" class="btn-selectedfile" @onclick="() => RemoveFile(file)">@file.Name X</button>
</div>

}
</div>



@if (displayform)
{
Expand Down Expand Up @@ -117,7 +130,13 @@

private void FileUploadHandler(InputFileChangeEventArgs e)
{
selectedfiles = e.GetMultipleFiles().ToList();
selectedfiles.AddRange(e.GetMultipleFiles());
}

private void RemoveFile(IBrowserFile file)
{
selectedfiles.Remove(file);

}

private void OnContactSearch(ChangeEventArgs e)
Expand Down
8 changes: 4 additions & 4 deletions src/MailLobbyer/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
},
"AllowedHosts": "*",
"SmtpClientSettings": {
"Sendername": "",
"Senderemail": "",
"Sendername": "Test",
"Senderemail": "Test@gmail.com",
"Host": "smtp.gmail.com",
"Password": "",
"Password": "okakgvqorczjjllu",
"Port": "587",
"Username": ""
"Username": "peterhamilton522@gmail.com"
}
}
Binary file modified src/MailLobbyer/bin/Debug/net7.0/MailLobbyer.dll
Binary file not shown.
Binary file modified src/MailLobbyer/bin/Debug/net7.0/MailLobbyer.pdb
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8bd370b3ceb9af3acf3e10547fbabc093d844f3e
f1f60feea4b3e69ee18e2c2c286dda81ea338bb7
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.csproj.AssemblyReference.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.GeneratedMSBuildEditorConfig.editorconfig
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.AssemblyInfoInputs.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.AssemblyInfo.cs
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.csproj.CoreCompileInputs.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.MvcApplicationPartsAssemblyInfo.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.RazorAssemblyInfo.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.RazorAssemblyInfo.cs
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/appsettings.Development.json
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/appsettings.json
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/MailLobbyer.staticwebassets.runtime.json
Expand All @@ -16,17 +8,36 @@
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/MailLobbyer.pdb
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/BouncyCastle.Cryptography.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/MailKit.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Connections.Abstractions.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Http.Connections.Client.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Http.Connections.Common.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Client.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Client.Core.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Common.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Protocols.Json.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Features.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Logging.Abstractions.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Options.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/MimeKit.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Newtonsoft.Json.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/System.Security.Cryptography.Pkcs.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/runtimes/win/lib/net7.0/System.Security.Cryptography.Pkcs.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.csproj.AssemblyReference.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.GeneratedMSBuildEditorConfig.editorconfig
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.AssemblyInfoInputs.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.AssemblyInfo.cs
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.csproj.CoreCompileInputs.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.MvcApplicationPartsAssemblyInfo.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.RazorAssemblyInfo.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.RazorAssemblyInfo.cs
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets/msbuild.MailLobbyer.Microsoft.AspNetCore.StaticWebAssets.props
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets/msbuild.build.MailLobbyer.props
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets/msbuild.buildMultiTargeting.MailLobbyer.props
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets/msbuild.buildTransitive.MailLobbyer.props
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets.pack.json
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets.build.json
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/staticwebassets.development.json
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/scopedcss/Shared/Footer.razor.rz.scp.css
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/scopedcss/Shared/MainLayout.razor.rz.scp.css
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/scopedcss/Shared/NavMenu.razor.rz.scp.css
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/scopedcss/bundle/MailLobbyer.styles.css
Expand All @@ -37,14 +48,3 @@
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.pdb
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.genruntimeconfig.cache
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/ref/MailLobbyer.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/obj/Debug/net7.0/scopedcss/Shared/Footer.razor.rz.scp.css
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Connections.Abstractions.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Http.Connections.Client.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.Http.Connections.Common.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Client.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Client.Core.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Common.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.AspNetCore.SignalR.Protocols.Json.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Features.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Logging.Abstractions.dll
/home/kitt/Documents/GitHub/MailLobbyer/src/MailLobbyer/bin/Debug/net7.0/Microsoft.Extensions.Options.dll
Binary file modified src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.dll
Binary file not shown.
Binary file modified src/MailLobbyer/obj/Debug/net7.0/MailLobbyer.pdb
Binary file not shown.
Loading

0 comments on commit 6387498

Please sign in to comment.