First note that $x$ and $f(x)$ are either both simultaneously rational or simultaneously irrational.
To prove that it is injective, let $f(x_1) = f(x_2)$. Then $f(x_1)$ and $f(x_2)$ are both rational or both irrational. Hence, either $x_1 = x_2$ or $1-x_1 = 1-x_2$. Both imply that $x_1 = x_2$.
Hence, $f(x)$ is injective.
If $x$ is rational, then $f(f(x)) = f(x) = x$.
If $x$ is irrational, then $f(f(x)) = f(\underbrace{1-x}_{\text{irrational}}) = 1-(1-x) = x$.
To show that $f$ is not continuous for all $x \neq \dfrac12$, approach $x$ by a sequence of rationals to get a limit of $x$ and a sequence of irrationals to get a limit of $1-x$.
For instance, if $x \neq \dfrac12$ is rational, consider the sequence $x_n = x-\dfrac{x}{n\sqrt{2}}$, to get $\lim_{n \to \infty} f(x_n) = 1-x \neq x = f(x)$
For instance, if $x \neq \dfrac12$ is irrational, consider the sequence $x_n = \dfrac{\lfloor 10^n x\rfloor}{10^n}$, to get $\lim_{n \to \infty} f(x_n) = x \neq 1-x = f(x)$
To show that $f$ is continuous at $x = \dfrac12$. Note that $\vert f(1/2+h) - f(1/2) \vert = h$, irrespective of $h$ being rational or irrational.