Skip to content

Commit 6a3fbb3

Browse files
committed
Merge pull request #20 from MrCull/improve_appearance
copy to clipboard control
2 parents 2d7a69a + b4e85f6 commit 6a3fbb3

19 files changed

+123
-217
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ bld/
3535

3636
# Visual Studio 2015/2017 cache/options directory
3737
.vs/
38+
.vscode/
3839
# Uncomment if you have tasks that create the project's static files in wwwroot
3940
#wwwroot/
4041

MyDevTools/Components/Pages/BranchNameFormatter.razor

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,18 @@
1313
</div>
1414

1515
<button class="btn btn-primary btn-block" @onclick="FormatGitBranchName">Format Git Branch Name</button>
16-
<button class="btn btn-success btn-block" @onclick="CopyToClipboard">Copy to Clipboard</button>
1716
</div>
1817
</div>
1918

2019
@if (!string.IsNullOrEmpty(formattedString))
2120
{
22-
<div class="row mt-4">
23-
<div class="col-md-6 offset-md-3">
24-
<div class="alert alert-success" role="alert">
25-
<strong>Formatted Branch Name:</strong>
26-
<textarea readonly class="form-control" rows="3">@formattedString</textarea>
27-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
28-
</div>
29-
</div>
30-
</div>
21+
<OutputAndCopyToClipboard OutputText="@formattedString" />
3122
}
3223
</div>
3324

3425
@code {
3526
private string inputString = "Feature 12345 : Example work item name";
3627
private string formattedString = "";
37-
private string copyConfirmationMessage = "";
3828

3929
protected override async Task OnInitializedAsync()
4030
{
@@ -59,17 +49,4 @@
5949
formattedString = "Error: " + ex.Message;
6050
}
6151
}
62-
63-
private async Task CopyToClipboard()
64-
{
65-
try
66-
{
67-
await ClipboardService.CopyToClipboardAsync(formattedString);
68-
copyConfirmationMessage = "Text copied to clipboard!";
69-
}
70-
catch (Exception ex)
71-
{
72-
copyConfirmationMessage = "Error: " + ex.Message;
73-
}
74-
}
7552
}

MyDevTools/Components/Pages/ColorPickerConverter.razor

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@
2121
</select>
2222
</div>
2323

24-
<div class="alert alert-success" role="alert">
25-
<strong>Converted Color:</strong>
26-
<pre>@convertedColor</pre>
27-
</div>
24+
<OutputAndCopyToClipboard OutputText="@convertedColor" />
2825
</div>
2926
</div>
3027
</div>

MyDevTools/Components/Pages/Components/DiffOutput.razor.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
.line-numbers {
33
counter-reset: line-number;
44
font-family: 'Courier New', monospace;
5-
background-color: #f4f4f4;
6-
border: 1px solid #ccc;
5+
background-color: var(--background-color);
6+
border: 1px solid var(--border-color);
77
padding: 10px;
88
line-height: 1;
99
margin: 0;

MyDevTools/Components/Pages/ContainerIds.razor

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,13 @@
2020

2121
<div class="d-flex justify-content-between">
2222
<button class="btn btn-primary btn-block" @onclick="GenerateCodes">Generate Ids</button>
23-
<button class="btn btn-success btn-block" @onclick="CopyToClipboard">Copy To Clipboard</button>
2423
</div>
2524
</div>
2625
</div>
2726

2827
@if (!string.IsNullOrEmpty(generatedCodes))
2928
{
30-
<div class="row mt-4">
31-
<div class="col-md-6 offset-md-3">
32-
<label>Generated Codes:</label>
33-
<textarea readonly class="form-control monospace-font" style="width: 180px;" rows="6">@generatedCodes</textarea>
34-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
35-
</div>
36-
</div>
29+
<OutputAndCopyToClipboard OutputText="@generatedCodes" />
3730
}
3831
</div>
3932

@@ -107,18 +100,4 @@
107100
}
108101
return sum % 11 % 10;
109102
}
110-
111-
112-
private async Task CopyToClipboard()
113-
{
114-
try
115-
{
116-
await ClipboardService.CopyToClipboardAsync(generatedCodes);
117-
copyConfirmationMessage = "Text copied to clipboard!";
118-
}
119-
catch (Exception ex)
120-
{
121-
Console.WriteLine(ex.Message);
122-
}
123-
}
124103
}

MyDevTools/Components/Pages/ContainerIds.razor.css

Lines changed: 0 additions & 7 deletions
This file was deleted.

MyDevTools/Components/Pages/CronGenerator.razor

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,12 @@
5959
</div>
6060

6161
<button class="btn btn-primary btn-block" @onclick="GenerateCronExpression">Generate Cron Expression</button>
62-
<button class="btn btn-success btn-block" @onclick="CopyToClipboard">Copy to Clipboard</button>
6362
</div>
6463
</div>
6564

6665
@if (!string.IsNullOrEmpty(cronExpression))
6766
{
68-
<div class="row mt-4">
69-
<div class="col-md-10 offset-md-1">
70-
<div class="alert alert-success" role="alert">
71-
<strong>Generated Cron Expression:</strong>
72-
<textarea readonly id="cronExpression" class="form-control" rows="3">@cronExpression</textarea>
73-
<div class="mt-2 text-success">@copyConfirmationMessage</div>
74-
</div>
75-
</div>
76-
</div>
67+
<OutputAndCopyToClipboard OutputText="@cronExpression" />
7768
}
7869
</div>
7970

@@ -106,17 +97,4 @@
10697
cronExpression = "Error: " + ex.Message;
10798
}
10899
}
109-
110-
private async Task CopyToClipboard()
111-
{
112-
try
113-
{
114-
await ClipboardService.CopyToClipboardAsync(cronExpression);
115-
copyConfirmationMessage = "Cron expression copied to clipboard!";
116-
}
117-
catch (Exception ex)
118-
{
119-
copyConfirmationMessage = "Error: " + ex.Message;
120-
}
121-
}
122100
}

MyDevTools/Components/Pages/GuidGenerator.razor

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,12 @@
2323
</div>
2424

2525
<button class="btn btn-primary btn-block" @onclick="GenerateGUID">Generate GUID</button>
26-
<button class="btn btn-success btn-block" @onclick="CopyToClipboard">Copy to Clipboard</button>
2726
</div>
2827
</div>
2928

3029
@if (guidResults != null && guidResults.Count > 0)
3130
{
32-
<div class="row mt-4">
33-
<div class="col-md-6 offset-md-3">
34-
<div class="alert alert-success" role="alert">
35-
<strong>GUID Results:</strong>
36-
<pre>@string.Join("\n", guidResults)</pre>
37-
</div>
38-
</div>
39-
</div>
31+
<OutputAndCopyToClipboard OutputText="@string.Join("\n", guidResults)" />
4032
}
4133
</div>
4234

@@ -71,16 +63,4 @@
7163
guidResults.Add(guid);
7264
}
7365
}
74-
75-
private async Task CopyToClipboard()
76-
{
77-
try
78-
{
79-
await ClipboardService.CopyToClipboardAsync(string.Join("\n", guidResults));
80-
}
81-
catch (Exception ex)
82-
{
83-
Console.WriteLine("Failed to copy to clipboard: " + ex.Message);
84-
}
85-
}
8666
}

MyDevTools/Components/Pages/HashGenerator.razor

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@
2929

3030
@if (!string.IsNullOrEmpty(hashResult))
3131
{
32-
<div class="row mt-4">
33-
<div class="col-md-6 offset-md-3">
34-
<div class="alert alert-success" role="alert">
35-
<strong>Hash Result:</strong>
36-
<pre>@hashResult</pre>
37-
</div>
38-
</div>
39-
</div>
32+
<OutputAndCopyToClipboard OutputText="@hashResult" />
4033
}
4134
</div>
4235

MyDevTools/Components/Pages/JsonFormatter.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
<label for="inputQuery">Input JSON (rest assured, your data stays on your device):</label>
7+
<br />
78
<iframe id="myiframe" src="iframepages/jsonformatter.html" height="650px" width="1050px" scrolling="no" />
89

910

0 commit comments

Comments
 (0)