PortalKit: refactor codes and add the others parts of view logic