H
HomarrCarlos Carneiro

Help finishing my widget

This is my first time contribution to the project and I am terrible with css since I work more with backend stuff. 1 . I need help understanding how to add descriptions to widget 2 . I need help trying to make my widget look good preferebly make it smaller Here is the code https://github.com/cacpmw/homarr/blob/widget/bitcoin/src/widgets/bitcoin/BitcoinWidgetTile.tsx
GitHub
homarr/src/widgets/bitcoin/BitcoinWidgetTile.tsx at widget/bitcoin ...
Customizable browser's home page to interact with your homeserver's Docker containers (e.g. Sonarr/Radarr) - cacpmw/homarr
No description
No description
Cakey Bot
Cakey Bot46d ago
Thank you for submitting a support request. Depending on the volume of requests, our team should get in contact with you shortly.
⚠️ Please include the following details in your post or we may reject your request without further comment: - Log (See https://homarr.dev/docs/community/faq#how-do-i-open-the-console--log) - Operating system (Unraid, TrueNAS, Ubuntu, ...) - Exact Homarr version (eg. 0.15.0, not latest) - Configuration (eg. docker-compose, screenshot or similar. Use ``your-text`` to format) - Other relevant information (eg. your devices, your browser, ...)
❓ Frequently Asked Questions | Homarr documentation
Can I install Homarr on a Raspberry Pi?
Tag
Tag45d ago
Hi, We like the idea of a cryptocurrency widget. Those are things that we might say once you make the PR but you might be interested to know it already: Would it be possible to have a more advanced one that does more than just Bitcoin? Is there any selfhosted app about crypto on which it could be based instead? (Since almost all our widgets are about selfhosting) For your questions: Description and name are set in the translation files. Sizing: use the h and w parameters to 100% to make sure they do not grow bigger than needed and search about flex. Personally I would put the image smaller on the left side with a price stack on the right.
Yossi
Yossi45d ago
Hi @Carlos Carneiro I can help you if needed. I’ll try to find if there is a self-hosting app for crypto.There are some websites for that.
Carlos Carneiro
Carlos Carneiro45d ago
I dont know many crypto apis. Also since I am not familiar with Homarr from a dev point of view I decided I wanted to a small contribution first. My plan is to increment this widget over time. I want to make it possible to verify transactions just by inputting an address too. I wanted to make it smaller but I terrible at styling things @Yossi if you can make my widget look good Id owe you one
Tag
Tag45d ago
API's can be tricky, which is why we prefer the ones from selfhosting. If you want to make a small contribution first, there are a few "good first issue" to tackle that we leave purposely for learning. If you want to stick to that one it's fine too, but you're going to have a lot of request really fast about doing more on the widget so I'd suggest doing them from the get go. (Also people doing their own updates on it, so potentially impeding your gradual work on it) Transactions may be a big security concern that goes way out of what homarr is, but I don't know enough about it to be sure, so just saying. About the styling, since you're learning maybe you can try yourself a bit more with the clues I gave, it's a good opportunity and I think you'd be capable with the context of my previous message.
Carlos Carneiro
Carlos Carneiro45d ago
All bitcoin transactions are public. When we lookup for a transaction by address we see all the public available information about that. Like when I am expecting some bitcoin i want to see how many confirmations are there for example and that is public available but i just dont wanna leave my dashboard. As of other people coming and contributing to this widget I am ok with that. But I will implement other functionalities already. I am feeling comfortable with it. As of my styling capabilities I have already tried a lot to learn how to work with css that is the one thing I can never learn.
Anyway I will try a bit more making it look beautiful and also find some selfhosted btc api but I dont think I will be successful on those ones
Tag
Tag45d ago
No need for CSS here, it's pure HTML
Carlos Carneiro
Carlos Carneiro45d ago
ok I will remove css and make it as simple as possible. Anyone willing to jumping and beautify it with styling is welcome About bitcoin selfhosted api, it might be possible to get information from a selfhosted bitcoin node I am not sure though
Tag
Tag45d ago
Had you actually done everything about styling in a CSS file on the side? everything can be done in the HTML part, even styling can be done in there. After a bit of research, it is true that selfhosted option for market monitoring doesn't seem to be that widespread if existing at all. Then I would only ask to use the most reliable and known source if possible. I think most website have an API, you just have to explicitly search for it.
Carlos Carneiro
Carlos Carneiro45d ago
This is my new style
No description
Carlos Carneiro
Carlos Carneiro45d ago
As far as I know https://mempool.space is among the most used bitcoin plataforms
The Mempool Open Source Project®
Explore the full Bitcoin ecosystem with mempool.space
Carlos Carneiro
Carlos Carneiro45d ago
and I just found out that they have their own node package @mempool/mempool.js
Tag
Tag45d ago
Yeah but that API is limited to bitcoin isn't it? Wouldn't it be better to have a tracker for a lot of crypto coins? The only one I know of is Binance and they have an API. No idea if they are trustworthy enough.
Carlos Carneiro
Carlos Carneiro45d ago
Yes mempool only supports bitcoin. It is a consensus between the cryptocurrency community that all other coins are called "shitcoins". Anyway, if anyone else would like to jumping on this one with me to add more coins is welcome. I my self only own bitcoins regarding binance is involved in a lot of scandals plus it is a chinese company which makes me frown upon them when it comes to trusting
Tag
Tag45d ago
Yeah there's a lot of that in the crypto space which is why I don't really like it. I think delivering data on all coins is best as most people will have shitcoins they want to follow.
Carlos Carneiro
Carlos Carneiro45d ago
Can someone help understand what is wrong with my useEffect
function BitcoinWidgetTile({ widget }: BitcoinWidgetTileProps) {
const [input, setInput] = useState('');
const [latestTransaction, setLatestTransaction] = useState<LatestAddressTransaction | undefined>(undefined);
const { data: initialData, isLoading, isError } = api.bitcoin.getInitialData.useQuery(undefined);
const { t } = useTranslation('modules/bitcoin');
useEffect(() => {
const { data: transaction } = api.bitcoin.getLatestAddressTransaction.useQuery(input);
setLatestTransaction(transaction);
console.log('useEffect');
}, [input]);
.
.
.
}
function BitcoinWidgetTile({ widget }: BitcoinWidgetTileProps) {
const [input, setInput] = useState('');
const [latestTransaction, setLatestTransaction] = useState<LatestAddressTransaction | undefined>(undefined);
const { data: initialData, isLoading, isError } = api.bitcoin.getInitialData.useQuery(undefined);
const { t } = useTranslation('modules/bitcoin');
useEffect(() => {
const { data: transaction } = api.bitcoin.getLatestAddressTransaction.useQuery(input);
setLatestTransaction(transaction);
console.log('useEffect');
}, [input]);
.
.
.
}
I am getting this error I cant seem to see the mistake:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
Tag
Tag45d ago
Not sure you can make an api call inside a useEffect You don't need to save the value from the API btw, not sure what you're trying to do here
Carlos Carneiro
Carlos Carneiro45d ago
I have an input field that should make api calls everytime input changes. I was avoiding to use a submit button but I guess I will have to use it
Tag
Tag45d ago
Yeah, never do that Just intercept the "enter" key and a button with onclick
Carlos Carneiro
Carlos Carneiro45d ago
No description
Tag
Tag45d ago
Also, you can use the onChange event of the textbox for that, but again, never make calls like that. If one user types out the whole thing by hand, it's gonna make a call every keystroke. That's bad
Carlos Carneiro
Carlos Carneiro45d ago
I know that. Usually users paste bitcoin addresses but the OnChange doesnt capture pasting Cant find the where should be stored the translation files Is there any code contributor docs?
Tag
Tag45d ago
Like I said, doesn't matter anyway, only capture the enter key. You might need to create one for your widget public\locales\en\modules
Carlos Carneiro
Carlos Carneiro45d ago
I did that but was unsure. Do I have to make it for every language out there?
Tag
Tag45d ago
No no no, only english. Don't do anything other than english
Carlos Carneiro
Carlos Carneiro45d ago
check this out
No description
Carlos Carneiro
Carlos Carneiro45d ago
i made the bitcoin module on the en folder
Carlos Carneiro
Carlos Carneiro45d ago
No description
Tag
Tag45d ago
Translation doesn't play nice with hot reloading, restart the debugging
Carlos Carneiro
Carlos Carneiro45d ago
working!!!
Tag
Tag45d ago
That's great :) Remember, any string that a user can see must be translatable, so use that file extensively
Carlos Carneiro
Carlos Carneiro45d ago
okay Okay, so I finished. I removed the option to input address for now cuz I couldnt get a nice solution. Hopefully I will improve it with more features.
Solution
Carlos Carneiro
Carlos Carneiro45d ago
GitHub
Widget: Bitcoin by cacpmw · Pull Request #1999 · ajnart/homarr
Category Widget Overview A very simple bitcoin widget to fetch current price in USD and EUR plus the current recommended fees per transaction. It uses the free mempool api I intend to improve this ...
Want results from more Discord servers?
Add your server
More Posts
App url with env interpolationHello, is there a way to use env interpolation for app external url? For instance: http ://myapp.${Mdash. doesnt display graphs on a fresh installI followed the install directions on the site and while I can access and use dash. directly via a weProxmox integration issue, Dev branchSo been trying to diagnose an issue with proxmox, since I am not much of a web dev, I have been stumDashhow do I setup dash I have it in my docker compose file but 2 things I am unsure really what ports IHomarr LaggingMy homarr instance keeps loading really slowly whenever i try to customize it, it is a brand new insWeather not pinging.I've installed the dashboard and everything works fine except the weather. It can't ping, and I can'Detected Protocol Downgradehey there i just finished my Homarr setup and everything works well except Dash widget after i enablbackground not working for meHi, first off, great app, really enjoying it. I can't get the custom background to work, i have goneNothing loading during setup processim sure this has been asked and answered a million times but I couldnt find the answer I was settingCant start the projectI am trying to develop a new widget to the project. This is the first time I am running the code herCant get server stats to worknot sure but the server status widget just sits at loading and never actually populates. if anyone cannot find proxmox intergrationHello I just installed homarr with docker-compose and for some reason cannot find proxmox intergratiLosing all saved api's for servicesHi, when I add website to homarr and set up integration after saving nothing happens (0 data from seUsing a non-standard protocol. This may require pre-installed applications and can introduce securitHello. How can i fix this issue if i don't want to secure it?sidebarHello guys, i wanted to ask if its possible to change the size of the sidebar? Is there a way to get400 bad request ping on JackettI suddenly started getting "Bad Request: 400 denied" ping on my Jackett app, despite it being accessStorage WidgetI've been looking around, I can't seem to find a storage widget anywhere. It would be really useful No supported Torrent clients foundI'm trying to show a torrent list with qBittorrent but it doesn't find it. What I did: 1. Add qBittHaving trouble getting homar to connect with Home AssistantHi, I have tried to integrateHome Assistant with my homarr page. Homarr is doing well enough to pinColoums in large size doesn't change when Enable left and Right sidebarset coloums large size doesn't change size of icon when enable left and right sidebar