forked from vultisig/vultiserver-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
315 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,53 @@ | ||
.container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100vh; | ||
} | ||
|
||
.navbar { | ||
height: 60px; | ||
background-color: var(--background-primary-color); | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.content { | ||
display: flex; | ||
flex: 1; | ||
} | ||
|
||
.left-section { | ||
background-color: var(--background-primary-color); | ||
border-right: 1px solid var(--border-normal-color); | ||
border-top: 1px solid var(--border-normal-color); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.right-section { | ||
flex: 1; | ||
background-color: var(--background-primary-color); | ||
border-top: 1px solid var(--border-normal-color); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.navbar, .left-section, .right-section { | ||
color: var(--text-light-color); | ||
} | ||
|
||
display: flex; | ||
flex-direction: column; | ||
width: 100vw; | ||
height: 100vh; | ||
overflow: hidden; | ||
background-color: var(--background-primary-color); | ||
scrollbar-width: thin; | ||
scrollbar-color: var(--background-primary-color) var(--background-primary-color); | ||
} | ||
|
||
.navbar { | ||
position: sticky; | ||
width: 100%; | ||
min-width: max-content; | ||
height: 60px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
} | ||
|
||
.content { | ||
display: flex; | ||
flex: 1; | ||
overflow: hidden; | ||
} | ||
|
||
.left-section { | ||
width: 350px; | ||
border-right: 1px solid var(--border-normal-color); | ||
border-top: 1px solid var(--border-normal-color); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: flex-start; /* Ensures content starts from the top */ | ||
padding: 2rem; | ||
overflow-y: auto; | ||
} | ||
|
||
.right-section { | ||
flex: 1; | ||
border-top: 1px solid var(--border-normal-color); | ||
display: flex; | ||
flex-direction: column; | ||
align-items: flex-start; /* Ensures content starts from the left */ | ||
justify-content: center; | ||
padding: 2rem; | ||
overflow-x: auto; | ||
} | ||
|
||
.navbar, .left-section, .right-section { | ||
color: var(--text-light-color); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
plugins-ui/src/modules/policy/components/policy-form/PolicyForm.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
.policy-form { | ||
display: flex; | ||
flex-direction: column; | ||
padding: 20px | ||
} | ||
|
||
form .form-control { | ||
|
35 changes: 35 additions & 0 deletions
35
plugins-ui/src/modules/policy/components/transaction-history/TransactionHistory.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.history-panel { | ||
padding: 16px; | ||
} | ||
|
||
.history-panel h2 { | ||
font-size: 1.25rem; | ||
border-bottom: 1px solid rgba(255, 255, 255, 0.2); | ||
padding-bottom: 6px; | ||
} | ||
|
||
.history-item { | ||
display: flex; | ||
justify-content: space-between; | ||
padding: 8px 0; | ||
border-bottom: 1px solid rgba(255, 255, 255, 0.1); | ||
} | ||
|
||
.history-item:last-child { | ||
border-bottom: none; | ||
} | ||
|
||
.history-date { | ||
font-weight: bold; | ||
} | ||
|
||
.history-time { | ||
width: 65px; | ||
font-style: italic; | ||
color: rgba(255, 255, 255, 0.8); | ||
} | ||
|
||
.history-status { | ||
color: var(--alert-success-color); | ||
} | ||
|
89 changes: 89 additions & 0 deletions
89
plugins-ui/src/modules/policy/components/transaction-history/TransactionHistory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
import { useEffect, useState } from "react"; | ||
import { usePolicies } from "../../context/PolicyProvider"; | ||
import { PolicyTransactionHistory } from "../../models/policy"; | ||
import "./TransactionHistory.css"; | ||
import Toast from "@/modules/core/components/ui/toast/Toast"; | ||
|
||
type TransactionHistoryProps = { | ||
policyId: string; | ||
}; | ||
|
||
const formatDate = (dateString: string): { date: string; time: string } => { | ||
const dateObj = new Date(dateString); | ||
return { | ||
date: dateObj.toLocaleDateString("en-GB", { | ||
day: "2-digit", | ||
month: "short", | ||
year: "numeric", | ||
}), // "26 Feb 2025" | ||
time: dateObj.toLocaleTimeString("en-GB", { | ||
hour: "2-digit", | ||
minute: "2-digit", | ||
second: "2-digit", | ||
}), // "14:25:35" | ||
}; | ||
}; | ||
|
||
const TransactionHistory = ({ policyId }: TransactionHistoryProps) => { | ||
const { getPolicyHistory } = usePolicies(); | ||
const [historyData, setHistoryData] = useState<PolicyTransactionHistory[]>( | ||
[] | ||
); | ||
|
||
const [toast, setToast] = useState<{ | ||
message: string; | ||
error?: string; | ||
type: "success" | "warning" | "error"; | ||
} | null>(null); | ||
|
||
useEffect(() => { | ||
const fetchPolicyHistory = async (): Promise<void> => { | ||
try { | ||
const fetchedHistory = await getPolicyHistory(policyId); | ||
setHistoryData(fetchedHistory); | ||
} catch (error: any) { | ||
console.error("Failed to get policy history:", error.message); | ||
setToast({ | ||
message: error.message || "Failed to get policy history", | ||
error: error.error, | ||
type: "error", | ||
}); | ||
} | ||
}; | ||
|
||
fetchPolicyHistory(); | ||
}, []); | ||
|
||
return ( | ||
<div className="history-panel"> | ||
<h2>Transaction History</h2> | ||
<ul> | ||
{historyData && | ||
historyData.map((item) => { | ||
const { date, time } = formatDate(item.updated_at); | ||
return ( | ||
<li key={item.id} className="history-item"> | ||
<span className="history-status">{item.status}</span> | ||
<span className="history-date">{date}</span> | ||
<span className="history-time">{time}</span> | ||
</li> | ||
); | ||
})} | ||
{!historyData && ( | ||
<li key={1} className="history-item"> | ||
Nothing to see here yet. | ||
</li> | ||
)} | ||
</ul> | ||
{toast && ( | ||
<Toast | ||
title={toast.message} | ||
type={toast.type} | ||
onClose={() => setToast(null)} | ||
/> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default TransactionHistory; |
Oops, something went wrong.