Skip to content

Commit

Permalink
Frontpage component
Browse files Browse the repository at this point in the history
  • Loading branch information
arildm committed Mar 13, 2024
1 parent 8da9df6 commit 66f5033
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 15 deletions.
1 change: 1 addition & 0 deletions app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h2>You need JavaScript to run Korp.</h2>
<header></header>
<div class="px-3 pb-3" id="content">
<searchtabs></searchtabs>
<frontpage></frontpage>
<results></results>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { textTabsComponent } from "./components/dynamic_tabs/text_tabs"
import { headerComponent } from "./components/header"
import { wordPictureComponent } from "./components/word_picture"
import { searchtabsComponent } from "./components/searchtabs"
import "./components/frontpage"
import { resultsComponent } from "./components/results"
import statemachine from "@/statemachine"

Expand Down
35 changes: 35 additions & 0 deletions app/scripts/components/frontpage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/** @format */
import angular from "angular"

export default angular.module("korpApp").component("frontpage", {
template: /* HTML */ `
<div ng-if="!$ctrl.hasResult()" class="my-4 flex justify-center">
<div ng-if="$ctrl.showDescription" class="max-w-screen-md text-lg">
<div
ng-if="$root._settings['description']"
ng-bind-html="$root._settings['description'] | locObj:lang | trust"
></div>
<div ng-if="!$root._settings['description']">Default description</div>
</div>
</div>
`,
bindings: {},
controller: [
"$rootScope",
"searches",
function ($rootScope, searches) {
const $ctrl = this

$ctrl.hasResult = () =>
searches.activeSearch ||
$rootScope.compareTabs.length ||
$rootScope.graphTabs.length ||
$rootScope.mapTabs.length

$ctrl.showDescription = false

// Don't show the mode description until the inital corpora have been selected, to avoid text behind any modals
$rootScope.$on("initialcorpuschooserchange", () => ($ctrl.showDescription = true))
},
],
})
14 changes: 0 additions & 14 deletions app/scripts/components/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ export const resultsComponent = {
</sidebar>
</div>
</div>
<!-- mode description -->
<div
ng-if="!$ctrl.hasResult() && $ctrl.showDescription"
style="margin: 0 auto; width: 650px; margin-top: 70px"
ng-bind-html="$root._settings['description'] | locObj:lang | trust"
></div>
</div>
`,
bindings: {},
Expand All @@ -141,14 +135,6 @@ export const resultsComponent = {
$rootScope.compareTabs.length ||
$rootScope.graphTabs.length ||
$rootScope.mapTabs.length

$ctrl.showDescription = false

// Don't show the mode description until the inital corpora has been selected, to avoid text behind any modals
$rootScope.$on(
"initialcorpuschooserchange",
() => ($ctrl.showDescription = settings["description"] != undefined)
)
},
],
}
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
module.exports = {
// pug doesn't support special characters in class names, so no colon.
separator: "_",
content: ["./app/**/*.js", "./app/**/*.html", "./app/**/*.pug"],
content: ["./app/**/*.js", "./app/**/*.ts", "./app/**/*.html"],
theme: {
extend: {
colors: {
Expand Down

0 comments on commit 66f5033

Please sign in to comment.