Cleanup some UI stuff

This commit is contained in:
Emil Nielsen 2023-04-07 08:24:41 +07:00
parent 595bd18b14
commit b84b8eadb5
7 changed files with 126 additions and 100 deletions

View File

@ -18,8 +18,8 @@ const BankAccountsView = (props: {
return ( return (
<div className="p-4"> <div className="p-4">
<div className="flex items-center gap-8"> <div className="flex items-center gap-8">
<div className="flex-1 border-2 border-white rounded-lg px-8 py-4"> <div className="flex-1 bg-gradient-to-tr from-purple-600 via-blue-600 to-indigo-700 h-auto p-1 rounded-xl">
<div className="text-white"> <div className="text-white bg-slate-900 px-8 py-4 rounded-xl">
<span className="text-green-600 font-bold">Moonbucks</span> <span className="text-green-600 font-bold">Moonbucks</span>
<h3 className="text-2xl font-bold"> <h3 className="text-2xl font-bold">
$ $

View File

@ -8,19 +8,21 @@ const InventoryItemView = (props: {
upgradeInventoryItem: (inventoryItemId: number, storeItemId: string) => void; upgradeInventoryItem: (inventoryItemId: number, storeItemId: string) => void;
}) => { }) => {
return ( return (
<div className="border-2 border-white text-white p-8 rounded-lg col-span-5"> <div className="bg-gradient-to-tr from-purple-600 via-blue-600 to-indigo-700 h-auto p-1 rounded-xl rounded-xl col-span-5">
<h2 className="text-3xl font-bold mb-4">Your Inventory</h2> <div className="bg-slate-900 text-white p-8 rounded-xl">
<div className="grid grid-cols-3 gap-8"> <h2 className="text-3xl font-bold mb-4">Your Inventory</h2>
{props.inventoryItems && <div className="grid grid-cols-3 gap-8">
props.inventoryItems.length > 0 && {props.inventoryItems &&
props.inventoryItems.map((inventoryItem, id) => ( props.inventoryItems.length > 0 &&
<InventoryItem props.inventoryItems.map((inventoryItem, id) => (
key={id} <InventoryItem
inventoryItem={inventoryItem} key={id}
upgradeInventoryItem={props.upgradeInventoryItem} inventoryItem={inventoryItem}
stakes={props.stakes} upgradeInventoryItem={props.upgradeInventoryItem}
/> stakes={props.stakes}
))} />
))}
</div>
</div> </div>
</div> </div>
); );

View File

@ -23,8 +23,8 @@ const NavbarVertical: React.FC<NavbarProps> = ({
}) => { }) => {
return ( return (
<div className=""> <div className="">
<nav className="border-2 border-white rounded-lg p-8 h-auto"> <nav className="bg-gradient-to-tr from-purple-600 via-blue-600 to-indigo-700 h-auto p-1 rounded-xl">
<ul className=""> <ul className="bg-slate-900 p-8 rounded-xl">
{menuItems.map((item) => ( {menuItems.map((item) => (
<li <li
key={item.componentKey} key={item.componentKey}

View File

@ -5,8 +5,8 @@ import { resourceToBg, resourceToFc } from "../../utils/helpers";
const ResourceAccount = (props: { account: IResourceAccount }) => { const ResourceAccount = (props: { account: IResourceAccount }) => {
return ( return (
<div className={"flex-1 border-2 border-white rounded-lg px-8 py-4"}> <div className="flex-1 bg-gradient-to-tr from-purple-600 via-blue-600 to-indigo-700 h-auto p-1 rounded-xl">
<div className="text-white"> <div className="bg-slate-900 text-white px-8 py-4 rounded-xl">
<span <span
className={resourceToFc(props.account.resourceType) + " font-bold"} className={resourceToFc(props.account.resourceType) + " font-bold"}
> >

View File

@ -21,7 +21,7 @@ const SelectDropdown: React.FC<ISelectDropdownProps> = (props) => {
<select <select
value={selectedValue} value={selectedValue}
onChange={handleChange} onChange={handleChange}
className="text-black flex-1 p-2 border border-gray-300 rounded-lg" className="text-black flex-1 p-2 border border-gray-300 rounded-lg hover:cursor-pointer"
> >
<option value="">Select</option> <option value="">Select</option>
{props.options.map((option, index) => ( {props.options.map((option, index) => (

View File

@ -24,6 +24,7 @@ const StakingSource = (props: {
null null
); );
const [selectedWellId, setSelectedWellId] = useState<number | null>(null); const [selectedWellId, setSelectedWellId] = useState<number | null>(null);
const [showInfo, setShowInfo] = useState(false);
// Check if claimable every second // Check if claimable every second
useEffect(() => { useEffect(() => {
@ -123,14 +124,37 @@ const StakingSource = (props: {
alt="Moon" alt="Moon"
width={props.stakingSource.size} width={props.stakingSource.size}
height={props.stakingSource.size} height={props.stakingSource.size}
onClick={() => setShowInfo(!showInfo)}
className="hover:cursor-pointer"
/> />
<div className="absolute -right-0 top-1/2 transform -translate-y-1/2 opacity-0 w-0 group-hover:w-96 group-hover:opacity-100 transition-all duration-200 hover:ease-in-out"> {showInfo && (
<div className="bg-slate-900 border-2 border-white rounded-xl p-4 text-white"> <div className="absolute -right-0 top-1/2 transform -translate-y-1/2 w-96">
<h3 className="text-xl font-bold mb-2"> <div className="bg-slate-500 border-2 border-white rounded-xl p-4 text-white">
{props.stakingSource.name} <button
</h3> onClick={() => {
<p className="text-sm">{props.stakingSource.description}</p> setShowInfo(!showInfo);
<div className="flex gap-4"> }}
className="text-white absolute -right-0 mr-4"
>
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={2}
stroke="currentColor"
className="w-6 h-6"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M6 18L18 6M6 6l12 12"
/>
</svg>
</button>
<h3 className="text-xl font-bold mb-2">
{props.stakingSource.name}
</h3>
<p className="text-sm">{props.stakingSource.description}</p>
<div className="flex-1"> <div className="flex-1">
<p className="font-bold mt-4 mb-2">Active Drills</p> <p className="font-bold mt-4 mb-2">Active Drills</p>
{activeStakes && {activeStakes &&
@ -160,53 +184,51 @@ const StakingSource = (props: {
</div> </div>
))} ))}
</div> </div>
<div className="flex-1"> <p className="font-bold mt-4 mb-2">Inactive Drills</p>
<p className="font-bold mt-4 mb-2">Inactive Drills</p> {props.inventoryItems &&
{props.inventoryItems && props.inventoryItems.map(
props.inventoryItems.map( (item, id) =>
(item, id) => !isActive(item) && (
!isActive(item) && ( <div
<div key={id}
key={id} className="border border-white rounded-xl p-3 mb-2 bg-black/20"
className="border border-white rounded-xl p-3 mb-2 bg-black/20" >
> <p className="font-bold">{item.storeItem.name}</p>
<p className="font-bold">{item.storeItem.name}</p> <p className="mt-2">Select Resource</p>
<p className="mt-2">Select Resource</p> <div className="flex">
<div className="flex"> <SelectDropdown
<SelectDropdown options={props.stakingSource.resourceWells.map(
options={props.stakingSource.resourceWells.map( (well): IOption => ({
(well): IOption => ({ value: well.id,
value: well.id, label: well.resourceType,
label: well.resourceType, })
})
)}
onChange={(value) =>
handleSelectChange(
value,
item.id,
item.storeItem.id
)
}
isActive={selectedItemId === item.id}
/>
{selectedItemId === item.id ? (
<button
onClick={handleStartMining}
className="bg-slate-100 text-slate-900 px-4 py-2 rounded-lg font-bold w-28 text-center ml-2"
>
Activate
</button>
) : (
<></>
)} )}
</div> onChange={(value) =>
handleSelectChange(
value,
item.id,
item.storeItem.id
)
}
isActive={selectedItemId === item.id}
/>
{selectedItemId === item.id ? (
<button
onClick={handleStartMining}
className="bg-slate-100 text-slate-900 px-4 py-2 rounded-lg font-bold w-28 text-center ml-2"
>
Activate
</button>
) : (
<></>
)}
</div> </div>
) </div>
)} )
</div> )}
</div> </div>
</div> </div>
</div> )}
</div> </div>
</div> </div>
); );

View File

@ -116,38 +116,40 @@ const StakingSourcesView = (props: {
const rows = handleRows(); const rows = handleRows();
return ( return (
<div className="border-2 border-white p-8 rounded-xl col-span-5"> <div className="bg-gradient-to-tr from-purple-600 via-blue-600 to-indigo-700 h-auto p-1 rounded-xl h-auto p-1 rounded-xl col-span-5">
<div className="flex items-center mb-4"> <div className="bg-slate-900 p-8 rounded-xl">
<h2 className="text-3xl text-white font-bold">Your Moons</h2> <div className="flex items-center mb-4">
<button <h2 className="text-3xl text-white font-bold">Your Moons</h2>
className="bg-green-600 rounded-full ml-2 p-1 inline" <button
onClick={() => props.createStakingSource()} className="bg-green-600 rounded-full ml-2 p-1 inline"
> onClick={() => props.createStakingSource()}
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={2}
stroke="currentColor"
className="w-6 h-6"
> >
<path <svg
strokeLinecap="round" xmlns="http://www.w3.org/2000/svg"
strokeLinejoin="round" fill="none"
d="M12 4.5v15m7.5-7.5h-15" viewBox="0 0 24 24"
/> strokeWidth={2}
</svg> stroke="currentColor"
</button> className="w-6 h-6"
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M12 4.5v15m7.5-7.5h-15"
/>
</svg>
</button>
</div>
{rows.map((stakingSources, index) => (
<Row
key={index}
stakingSources={stakingSources}
inventoryItems={props.inventoryItems}
claimStake={props.claimStake}
startStake={props.startStake}
/>
))}
</div> </div>
{rows.map((stakingSources, index) => (
<Row
key={index}
stakingSources={stakingSources}
inventoryItems={props.inventoryItems}
claimStake={props.claimStake}
startStake={props.startStake}
/>
))}
</div> </div>
); );
}; };