move badge rendering code to shared/