Ported the query builder panel and functionality, including adding stories and refactoring relevant components.