Hello and welcome! (I've moved this thread to the morphosyntax forum.)
Remember the most basic principle of syntax trees: constituency. If you've identified the if part (e.g. "if you work hard") as a CP, then you've also implicitly identified it as a constituent.* Now that means that the whole clause is a single node in the tree (that's what a constituent is); that is, the position of a phrase is equivalent to the position of a single word. Internally there's more structure, but you can set that aside while figuring out where to attach it. We might also try to replace it with a single word and see what that tree would look like: in this case there isn't necessarily an exact equivalent, but something like "therefore" seems reasonably close.
(*Note that this does not necessarily apply to your comment about the second as a "TP": assuming the if-CP is embedded within the TP, then the whole sentence is a TP, but the sentence without the CP is
not a TP or even a complete consituent on its own! If you assume a position for the CP outside of the TP, e.g. at a higher level in the tree [see some comments below about other options], then that might work out, but under the most basic assumption of an adjunct within TP, then there is no independent TP without including that CP within it! This is why constituency should be your first step in the analysis, rather than jumping to or guessing about possible labels.)
In general, conditional clauses with if are considered to be some kind of adverbial clause. In other words, they would appear in a similar position to other adverbials (like adverb phrases, similarly-functioning prepositonal phrases, e.g. "on Tuesday", etc.). Therefore, it would be an adjunct at a high level in the tree, probably in TP.
Another possibility would be to give it some kind of special analysis (distinct from other kinds of adverbials). You might imagine several structures, perhaps some kind of "CondP" (conditional phrase) split into antecedent/protasis and consequent/apodosis, but that's not a typical analysis and would require some kind of unusual structure in the syntax tree (resembling a construction-based analysis rather than a maximally general syntax tree as is usually desired in a typical Generative analysis, where the trees share as much structure as possible across all sentence types). But we still might consider some other position for the "if" clause, and one option for that might be as topic. If you're familiar with Rizzi's "fine structure of the left periphery" you might know that CP has now been proposed to be split into multiple phrases such as TopicP, FocusP, etc., so that could be a natural position. Or simply as an adjunct or topic within CP more generally. In the typological literature there is also some support for that kind of approach, e.g.:
Haiman, John. 1978. Conditionals Are Topics.
Language 54(3). 564–589.
https://doi.org/10.2307/412787If you're just starting out in syntax, then something you'll probably have started to notice (or will notice soon) is that there isn't just one answer to questions like this. It depends on the specific version of the theory you're using-- so it depends on your textbook, on your instructor, and ultimately your own preferences and assumptions in syntactic analysis. There will be similarities between analyses, but there are different options (some bigger differences, and some smaller differences), but at some point you will need to pick one. It's best to follow as closely as possible whatever you're already working with (especially if you're in a class, or working with an advisor for your own research as a student), but you'll have to see what fits best. The simplest answer here is as an adjunct in TP, but there are other options including a special topic position, or other possibilities.
The next step, of course, would be to start reading more about this. A lot has been written about conditionals, both in general (e.g. browse some textbooks and see what they have to say, or look for a reference chapter on conditionals in one of the several useful "Handbooks" of syntax that have been published), or for specific languages (and see whether the analyses proposed for different languages converge, or if there are meaningful reasons why different approaches have been suggested for different languages).