Consider the following: $$u_t+uu_x=0, ~~ t>0$$
and the initial data: $$ u(x,0)=\begin{cases} 1,&\text{ if }x\in[0,1]\text{ and } \\ 0,&\text{ otherwise. } \end{cases}$$
I have found a solution to the above problem like the following picture but is valid only for $t<2$ ...I do not know how to extend this solution for all $t>0$. Any hint please?

Remark: I have found this weak solution drawing the characteristic lines of the problem and applying a shock and fan wave where the characteristics intersect and where a "gap" is created, respectively. I confirmed this solution using Runkine - Hugionot theorem.
After $t=2$ you have that the rarefaction segment $0<x<a(t)$ where $u(x,t)=x/t$ is directly followed by the "unchanged" segment with $u(x,t)=0$ on $a(t)<x<\infty$. The change of the phase boundary is again governed by the Runkine-Hugionot condition, that is $$ \dot a(t)=\frac{a(t)/t+0}{2}\implies a(t)=c\sqrt{t} $$ and from the initial condition $a(2)=2$ it follows that $c=\sqrt2$, $a(t)=\sqrt{2t}$.
See Burgers' equation after rarefaction wave catches up with the shock for a more extensive discussion of this situation.