Use t.map

This commit is contained in:
RMidhunSuresh 2022-08-26 14:55:01 +05:30
parent b440bdcff0
commit bba2d9f0a9

View File

@ -14,31 +14,32 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import {TemplateView, InlineTemplateView} from "./general/TemplateView"; import {TemplateView} from "./general/TemplateView";
import {spinner} from "./common.js"; import {spinner} from "./common.js";
export class ForcedLogoutView extends TemplateView { export class ForcedLogoutView extends TemplateView {
render(t, vm) { render(t) {
const proceedView = new InlineTemplateView(vm, t => { return t.div({ className: "LogoutScreen" }, [
return t.div([ t.div({ className: "content" },
t.p("Your access token is no longer valid! You can reauthenticate in the next screen."), t.map(vm => vm.showStatus, (showStatus, t, vm) => {
t.div({ className: "button-row" }, [ if (showStatus) {
t.button({ return t.p({ className: "status" }, [
className: "button-action primary", spinner(t, { hidden: vm => !vm.showSpinner }),
type: "submit", t.span(vm => vm.status)
onClick: () => vm.proceed(), ]);
}, vm.i18n`Proceed`) }
]), else {
]); return t.div([
}); t.p("Your access token is no longer valid! You can reauthenticate in the next screen."),
const progressView = new InlineTemplateView(vm, t => { t.div({ className: "button-row" }, [
return t.p({className: "status"}, [spinner(t, {hidden: vm => !vm.showSpinner}), t.span(vm => vm.status)]); t.button({
}); className: "button-action primary",
type: "submit",
return t.div({className: "LogoutScreen"}, [ onClick: () => vm.proceed(),
t.div({className: "content"}, }, vm.i18n`Proceed`)
t.mapView(vm => vm.showStatus, showStatus => { ]),
return showStatus? progressView: proceedView; ]);
}
}) })
), ),
]); ]);