|
import streamlit as st
|
|
import pandas as pd
|
|
from datetime import datetime, timedelta
|
|
import numpy as np
|
|
import altair as alt
|
|
|
|
|
|
st.set_page_config(page_title="Mminer Dashboard", page_icon="⛏️", layout="wide")
|
|
|
|
|
|
st.title("Mminer Dashboard")
|
|
st.markdown("Welcome to the Mminer platform. Monitor your mining activities and token balance.")
|
|
|
|
|
|
st.sidebar.header("User Info")
|
|
user_name = st.sidebar.text_input("Username")
|
|
user_balance = st.sidebar.number_input("Token Balance", min_value=0.0, format="%.2f")
|
|
|
|
|
|
col1, col2 = st.columns(2)
|
|
|
|
with col1:
|
|
st.subheader("Mining Activity")
|
|
|
|
|
|
dates = [datetime.now() - timedelta(days=x) for x in range(30)]
|
|
hash_rates = [100 + x * 2 for x in range(30)]
|
|
|
|
df = pd.DataFrame({"Date": dates, "Hash Rate (MH/s)": hash_rates})
|
|
|
|
st.line_chart(df.set_index("Date"))
|
|
|
|
with col2:
|
|
st.subheader("Token Distribution")
|
|
|
|
|
|
distribution = {
|
|
"Mining Rewards": 5000,
|
|
"Staking": 3000,
|
|
"Purchases": 1500,
|
|
"Airdrops": 500
|
|
}
|
|
|
|
st.bar_chart(distribution)
|
|
|
|
|
|
st.header("Mining Control")
|
|
col3, col4 = st.columns(2)
|
|
|
|
with col3:
|
|
st.subheader("Start/Stop Mining")
|
|
if st.button("Start Mining"):
|
|
st.success("Mining started successfully!")
|
|
if st.button("Stop Mining"):
|
|
st.error("Mining stopped.")
|
|
|
|
with col4:
|
|
st.subheader("Mining Pool")
|
|
selected_pool = st.selectbox("Select Mining Pool", ["Pool A", "Pool B", "Pool C"])
|
|
st.write(f"Currently mining with: {selected_pool}")
|
|
|
|
|
|
st.header("Token Transactions")
|
|
transaction_amount = st.number_input("Amount", min_value=0.0, format="%.2f")
|
|
recipient = st.text_input("Recipient Address")
|
|
if st.button("Send Tokens"):
|
|
st.success(f"Successfully sent {transaction_amount} tokens to {recipient}")
|
|
|
|
|
|
st.header("Mminer Theremin")
|
|
st.markdown("Use this theremin-like feature to 'hear' your mining activity!")
|
|
|
|
|
|
frequency = st.slider("Frequency (representing hash rate)", 200, 2000, 440)
|
|
volume = st.slider("Volume (representing token balance)", 0.0, 1.0, 0.5)
|
|
|
|
|
|
duration = 3
|
|
sample_rate = 44100
|
|
t = np.linspace(0, duration, int(sample_rate * duration), False)
|
|
note = np.sin(frequency * t * 2 * np.pi)
|
|
audio = note * volume
|
|
|
|
|
|
audio_df = pd.DataFrame({"time": t, "amplitude": audio})
|
|
chart = alt.Chart(audio_df).mark_line().encode(
|
|
x="time",
|
|
y="amplitude"
|
|
).properties(
|
|
width=600,
|
|
height=200
|
|
)
|
|
st.altair_chart(chart)
|
|
|
|
|
|
if st.button("Play Theremin"):
|
|
st.audio(audio, sample_rate=sample_rate)
|
|
|
|
|
|
st.markdown("---")
|
|
st.markdown("© 2024 Mminer. All rights reserved.") |