Just doesn’t “refer to the present”; if your textbook says that, then your textbook is wrong.
When used with a verb whose action occurs anterior to the point of reference—i.e., a verb that incorporates some kind of ‘pastness’—it narrows down the scope of this ‘pastness’ to specify that the verb action occurred very shortly before the point of reference.
There are four verbal constructions that incorporate ‘pastness’: the simple past, the present perfect, the past perfect (aka pluperfect), and the future perfect.
For the simple past and the present perfect, the point of reference is the present moment: the time when you utter your statement. The past tense indicates that the verb happened before the moment of speaking. All perfect constructions indicate a state that came about as the result of a verbal action; the present perfect indicates that this state is the current state at the present moment of speaking, so the verbal action that resulted in this state naturally took place before the moment of speaking.
For the past perfect, the point of reference is some point in the past (one that is presumed to be familiar to the listener). Like the present perfect, it describes a result state, but the past perfect indicates that the state was the current one at the previously mentioned point in the past—this of course means that the verbal action that resulted in this state happened before that point in the past.
The exact same thing goes for the future perfect, except that the point of reference is now some point (presumed familiar to the listener) in the future, rather than in the past.
Adding just to any of these constructions simply narrows down the ‘pastness’ (for the simple past, the time of the verbal action itself; for the perfect constructions, the time of the verbal action that resulted in entering into the state being described) to taking place very shortly before the point of reference, rather than just any time before the point of reference.
To give some examples all of which are grammatical and make sense:
- Simple past: I just ate.
The point of reference is the moment of speaking, i.e., now. The act of eating took place before the moment of speaking. Without just, it took place at some unspecified time before speaking; with just, it took place a very short time before speaking.
- Present perfect: I have just eaten.
The point of reference is the moment of speaking. The current state is one that came about as the result of eating; i.e., I am in a having-eaten state. The act that resulted in me entering into this state was the act of eating, which took place (a very short time) before the moment of speaking.
- Past perfect: I had just eaten.
The point of reference is some unspecified time in the past. The current state at that past point came about as the result of eating, and the act of eating that caused that state took place (a very short time) before the point in the past that we’re talking about. In simpler terms, let’s say the point of reference is exactly two hours ago: “Two hours ago, I had just eaten”. The state was then current two hours ago, and the act of eating that caused it took place perhaps two hours and ten minutes ago.
- Future perfect: I will just have eaten.
The point of reference is some unspecified time in the future. At that future point, the current state is one that came about as the result of eating. The act of eating that caused this state took place at some point before the point in the future we’re talking about. If we narrow it down: “In two hours, I will just have eaten”, the state is current in two hours’ time, and the act of eating that caused it took place a very short time before that—i.e., it hasn’t happened yet, but will happen in perhaps one hour and 55 minutes.
(In the future perfect, you can be almost 100% sure that the verbal act that causes the state has not happened yet. So if I say, “I will just have eaten”, you can be sure that you haven’t already eaten at the moment when you’re saying the words.)