Skip to content

Commit 482afd0

Browse files
committed
Refactor Home.razor for dynamic button rendering
Refactored the `Home.razor` component to improve the UI by dynamically rendering buttons based on the state of `ApiKey` and `KnowledgebaseFileExists`. Consolidated conditional logic into a single `<div>` for better structure and maintainability. Added a new `SettingsClicked` method to handle navigation to the Settings page and update visibility states. Removed redundant `<div>` blocks for cleaner code.
1 parent 20a24c4 commit 482afd0

1 file changed

Lines changed: 27 additions & 13 deletions

File tree

  • RFPResponsePOC/RFPResponsePOC.Client/Pages

RFPResponsePOC/RFPResponsePOC.Client/Pages/Home.razor

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,23 @@ else
6767
@if (HomeVisible)
6868
{
6969
<div class="rz-p-4 rz-container">
70-
70+
<div class="rz-col-12 rz-text-center rz-py-4" style="display: flex; justify-content: center; align-items: center;">
71+
@if (ApiKey.Length < 2)
72+
{
73+
<RadzenButton class="step-button" Text="To get started enter your AI key on the Settings page" Click="@SettingsClicked" Style="background-color: green;" ButtonStyle="ButtonStyle.Primary" />
74+
}
75+
else
76+
{
77+
@if (!KnowledgebaseFileExists)
78+
{
79+
<RadzenButton class="step-button" Text="Build your Knowledgebase" Click="@KnowledgebaseClicked" Style="background-color: green;" ButtonStyle="ButtonStyle.Primary" />
80+
}
81+
else
82+
{
83+
<RadzenButton class="step-button" Text="Click here to create an RFP Response" Click="@ResponseClicked" Style="background-color: green;" ButtonStyle="ButtonStyle.Primary" />
84+
}
85+
}
86+
</div>
7187
<!-- HERO -->
7288
<RadzenCard Style="background: linear-gradient(180deg, #0d47a1 0%, #1565c0 100%); color: white;">
7389
<div class="rz-grid rz-align-center rz-justify-between">
@@ -88,18 +104,6 @@ else
88104
</p>
89105
</RadzenCard>
90106
</div>
91-
<div>
92-
@if (!KnowledgebaseFileExists)
93-
{
94-
<RadzenButton class="step-button" Text="Build Knowledgebase" Click="@KnowledgebaseClicked" Style="background-color: green;" ButtonStyle="ButtonStyle.Primary" />
95-
<br />
96-
<br />
97-
}
98-
else
99-
{
100-
<RadzenButton class="step-button" Text="Create a RFP Response" Click="@ResponseClicked" Style="background-color: green;" ButtonStyle="ButtonStyle.Primary" />
101-
}
102-
</div>
103107
</div>
104108
</RadzenCard>
105109

@@ -576,6 +580,16 @@ else
576580
KnowledgebaseVisible = false;
577581
}
578582

583+
void SettingsClicked(MouseEventArgs args)
584+
{
585+
ActiveMenuItem = "Settings";
586+
HomeVisible = false;
587+
SettingsVisible = true;
588+
ResponseVisible = false;
589+
LogsVisible = false;
590+
KnowledgebaseVisible = false;
591+
}
592+
579593
void OnLogsClicked(MenuItemEventArgs args)
580594
{
581595
ActiveMenuItem = "Logs";

0 commit comments

Comments
 (0)