Skip to content

Commit e31088c

Browse files
authored
Merge pull request #9 from DuendeSoftware/mb/redesign
Redesign landing page for demo server
2 parents 414fea3 + 089821b commit e31088c

File tree

7 files changed

+1219
-143
lines changed

7 files changed

+1219
-143
lines changed

src/Pages/DemoServerUtilities.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
using Duende.IdentityServer.Models;
2+
3+
namespace Duende.IdentityServer.Demo.Pages;
4+
5+
public static class DemoServerUtilities
6+
{
7+
public static string HumanizeAllowedGrantTypes(ICollection<string> grantTypes)
8+
{
9+
if (grantTypes.SequenceEqual(GrantTypes.Implicit))
10+
return "implicit";
11+
12+
if (grantTypes.SequenceEqual(GrantTypes.ImplicitAndClientCredentials))
13+
return "implicit and client credentials";
14+
15+
if (grantTypes.SequenceEqual(GrantTypes.Code))
16+
return "authorization code";
17+
18+
if (grantTypes.SequenceEqual(GrantTypes.CodeAndClientCredentials))
19+
return "authorization code and client credentials";
20+
21+
if (grantTypes.SequenceEqual(GrantTypes.Hybrid))
22+
return "hybrid";
23+
24+
if (grantTypes.SequenceEqual(GrantTypes.HybridAndClientCredentials))
25+
return "hybrid and client credentials";
26+
27+
if (grantTypes.SequenceEqual(GrantTypes.ClientCredentials))
28+
return "client credentials";
29+
30+
if (grantTypes.SequenceEqual(GrantTypes.ResourceOwnerPassword))
31+
return "resource owner password";
32+
33+
if (grantTypes.SequenceEqual(GrantTypes.ResourceOwnerPasswordAndClientCredentials))
34+
return "resource owner password and client credentials";
35+
36+
if (grantTypes.SequenceEqual(GrantTypes.DeviceFlow))
37+
return "device flow";
38+
39+
if (grantTypes.SequenceEqual(GrantTypes.Ciba))
40+
return "ciba";
41+
42+
return string.Join(" ", grantTypes);
43+
}
44+
45+
public static string HumanizeLifetime(TimeSpan lifetime)
46+
{
47+
var components = new List<string>();
48+
if (lifetime.TotalHours > 0)
49+
{
50+
components.Add(Math.Floor(lifetime.TotalHours) + "h");
51+
}
52+
if (Math.Floor(lifetime.TotalMinutes % 60) > 0)
53+
{
54+
components.Add(Math.Floor(lifetime.TotalMinutes % 60) + "m");
55+
}
56+
if (Math.Floor(lifetime.TotalSeconds % 60) > 0)
57+
{
58+
components.Add(Math.Floor(lifetime.TotalSeconds % 60) + "s");
59+
}
60+
61+
return string.Join(" ", components);
62+
}
63+
64+
public static string? HumanizeClientIdPrefix(string clientIdPrefix) =>
65+
clientIdPrefix switch
66+
{
67+
"m2m" => "Machine-to-Machine",
68+
"interactive" => "Interactive clients",
69+
"native" => "Native clients",
70+
"device" => "Device flow",
71+
"login" => "Login",
72+
_ => clientIdPrefix
73+
};
74+
}

src/Pages/Index.cshtml

Lines changed: 179 additions & 128 deletions
Large diffs are not rendered by default.

src/wwwroot/css/site.css

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,40 @@
1-
.welcome-page .logo {
1+
.welcome-page .logo {
22
width: 64px;
33
}
44

5+
/* Accordion styles */
6+
.collapsible-link::before {
7+
content: "";
8+
width: 14px;
9+
height: 2px;
10+
background: #333;
11+
position: absolute;
12+
top: calc(50% - 1px);
13+
right: 1rem;
14+
display: block;
15+
transition: all 0.3s;
16+
}
17+
18+
.collapsible-link::after {
19+
content: "";
20+
width: 2px;
21+
height: 14px;
22+
background: #333;
23+
position: absolute;
24+
top: calc(50% - 7px);
25+
right: calc(1rem + 6px);
26+
display: block;
27+
transition: all 0.3s;
28+
}
29+
30+
.collapsible-link[aria-expanded=true]::after {
31+
transform: rotate(90deg) translateX(-1px);
32+
}
33+
34+
.collapsible-link[aria-expanded=true]::before {
35+
transform: rotate(180deg);
36+
}
37+
538
.icon-banner {
639
width: 32px;
740
}
@@ -11,11 +44,6 @@
1144
padding-bottom: 40px;
1245
}
1346

14-
.welcome-page li {
15-
list-style: none;
16-
padding: 4px;
17-
}
18-
1947
.logged-out-page iframe {
2048
display: none;
2149
width: 0;

src/wwwroot/css/site.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/wwwroot/css/site.scss

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@
44
}
55
}
66

7+
/* Accordion styles */
8+
.collapsible-link::before {
9+
content: '';
10+
width: 14px;
11+
height: 2px;
12+
background: #333;
13+
position: absolute;
14+
top: calc(50% - 1px);
15+
right: 1rem;
16+
display: block;
17+
transition: all 0.3s;
18+
}
19+
20+
.collapsible-link::after {
21+
content: '';
22+
width: 2px;
23+
height: 14px;
24+
background: #333;
25+
position: absolute;
26+
top: calc(50% - 7px);
27+
right: calc(1rem + 6px);
28+
display: block;
29+
transition: all 0.3s;
30+
}
31+
32+
.collapsible-link[aria-expanded='true']::after {
33+
transform: rotate(90deg) translateX(-1px);
34+
}
35+
36+
.collapsible-link[aria-expanded='true']::before {
37+
transform: rotate(180deg);
38+
}
39+
740
.icon-banner {
841
width: 32px;
942
}
@@ -13,13 +46,6 @@
1346
padding-bottom: 40px;
1447
}
1548

16-
.welcome-page {
17-
li {
18-
list-style: none;
19-
padding: 4px;
20-
}
21-
}
22-
2349
.logged-out-page {
2450
iframe {
2551
display: none;
@@ -47,4 +73,4 @@
4773
font-weight: bold;
4874
}
4975
}
50-
}
76+
}

0 commit comments

Comments
 (0)