Refactor code for better readability.

This commit is contained in:
pluja 2023-11-13 07:15:11 +01:00
parent d3bfef3275
commit 6decdcb4fb

View File

@ -1,23 +1,32 @@
<section class="mt-10 mb-5">
<section class="p-2 mt-10 mb-2">
<div class="flex items-center justify-center space-x-4">
<img class="rounded-full w-14 h-14" src="{{.Service.LogoURL}}" alt="">
<span class="flex items-center justify-center capitalize">
<span class="text-3xl font-bold">{{.Service.Name}}</span>
{{if .Service.Verified}}
<a href="/about#verified">
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6 ml-1 {{if .Service.Verified}}text-blue-400/80{{else}} text-white/20 {{end}} discount-check-filled" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z" stroke-width="0" fill="currentColor"></path>
</svg>
</a>
<a href="/about#verified">
<svg xmlns="http://www.w3.org/2000/svg"
class="w-6 h-6 ml-1 {{if .Service.Verified}}text-blue-400/80{{else}} text-white/20 {{end}} discount-check-filled"
width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path
d="M12.01 2.011a3.2 3.2 0 0 1 2.113 .797l.154 .145l.698 .698a1.2 1.2 0 0 0 .71 .341l.135 .008h1a3.2 3.2 0 0 1 3.195 3.018l.005 .182v1c0 .27 .092 .533 .258 .743l.09 .1l.697 .698a3.2 3.2 0 0 1 .147 4.382l-.145 .154l-.698 .698a1.2 1.2 0 0 0 -.341 .71l-.008 .135v1a3.2 3.2 0 0 1 -3.018 3.195l-.182 .005h-1a1.2 1.2 0 0 0 -.743 .258l-.1 .09l-.698 .697a3.2 3.2 0 0 1 -4.382 .147l-.154 -.145l-.698 -.698a1.2 1.2 0 0 0 -.71 -.341l-.135 -.008h-1a3.2 3.2 0 0 1 -3.195 -3.018l-.005 -.182v-1a1.2 1.2 0 0 0 -.258 -.743l-.09 -.1l-.697 -.698a3.2 3.2 0 0 1 -.147 -4.382l.145 -.154l.698 -.698a1.2 1.2 0 0 0 .341 -.71l.008 -.135v-1l.005 -.182a3.2 3.2 0 0 1 3.013 -3.013l.182 -.005h1a1.2 1.2 0 0 0 .743 -.258l.1 -.09l.698 -.697a3.2 3.2 0 0 1 2.269 -.944zm3.697 7.282a1 1 0 0 0 -1.414 0l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.32 1.497l2 2l.094 .083a1 1 0 0 0 1.32 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"
stroke-width="0" fill="currentColor"></path>
</svg>
</a>
{{end}}
</span>
</div>
<!-- Links -->
<div class="flex items-center justify-center mt-4 font-bold text-md md:text-md">
<div class="flex items-center justify-center">
<a href="{{index .Service.Urls 0}}" target="_blank" class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-world-www" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<a href="{{index .Service.Urls 0}}" target="_blank"
class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-world-www" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M19.5 7a9 9 0 0 0 -7.5 -4a8.991 8.991 0 0 0 -7.484 4"></path>
<path d="M11.5 3a16.989 16.989 0 0 0 -1.826 4"></path>
@ -28,12 +37,15 @@
<path d="M2 10l1 4l1.5 -4l1.5 4l1 -4"></path>
<path d="M17 10l1 4l1.5 -4l1.5 4l1 -4"></path>
<path d="M9.5 10l1 4l1.5 -4l1.5 4l1 -4"></path>
</svg>
</svg>
<span>Website</span>
</a>
{{if ne (len .Service.TosUrls) 0}}
<a href="{{index .Service.TosUrls 0}}" target="_blank" class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-report-search" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<a href="{{index .Service.TosUrls 0}}" target="_blank"
class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-report-search" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M8 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h5.697"></path>
<path d="M18 12v-5a2 2 0 0 0 -2 -2h-2"></path>
@ -47,8 +59,11 @@
</a>
{{end}}
{{if ne .Service.Referral ""}}
<a href="#" target="_blank" class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-users" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<a href="#" target="_blank"
class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-white transition duration-300 border rounded bg-zinc-900 border-zinc-700 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-users" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M9 7m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0"></path>
<path d="M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2"></path>
@ -59,8 +74,11 @@
</a>
{{end}}
{{if ne (len .Service.OnionUrls) 0}}
<a href="#" target="_blank" class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-purple-600 transition duration-300 border border-purple-900 rounded bg-zinc-900 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-target" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<a href="#" target="_blank"
class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center text-purple-600 transition duration-300 border border-purple-900 rounded bg-zinc-900 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 tabler-target" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"></path>
<path d="M12 12m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0"></path>
@ -69,12 +87,15 @@
<span>Tor</span>
</a>
{{end}}
<a href="#discuss" class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center transition duration-300 border rounded text-sky-400 border-sky-700 bg-zinc-900 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 messages" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<a href="#discuss"
class="flex items-center justify-center px-2 py-1 m-1 space-x-2 text-center transition duration-300 border rounded text-sky-400 border-sky-700 bg-zinc-900 hover:border-lime-600 hover:text-lime-600">
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 messages" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M21 14l-3 -3h-7a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1h9a1 1 0 0 1 1 1v10"></path>
<path d="M14 15v2a1 1 0 0 1 -1 1h-7l-3 3v-10a1 1 0 0 1 1 -1h2"></path>
</svg>
</svg>
</a>
</div>
</div>
@ -94,57 +115,60 @@
<span>Usage Guide</span>
</a>
</div>-->
<!-- Icons -->
<div class="flex items-center justify-center mt-2 mb-4">
<a href="/about#icons" class="max-w-md text-xs">
{{template "components/service_icons" .Service}}
</a>
</div>
<!-- Description -->
<div class="flex items-center justify-center mt-4">
<p class="max-w-lg p-4 text-sm border rounded-lg md:text-base border-white/20 bg-gray-400/10">
{{if ne .Service.Description ""}}
{{.Service.Description}}
{{.Service.Description}}
{{else}}
This {{.Service.Type}} does not have a description.
This {{.Service.Type}} does not have a description.
{{end}}
</p>
</div>
</section>
<!-- KYC Level -->
<section class="flex items-center justify-center px-4 mb-2">
<section class="flex items-center justify-center px-2 mb-2">
{{template "components/kyc_level" .Service.KycLevel}}
</section>
<!-- Attributes -->
<section class="flex flex-col items-center justify-center p-4">
{{if .Attributes}}
<div class="grid grid-cols-1 gap-2 md:grid-cols-2">
{{range .Attributes}}
{{template "components/attribute_line" .}}
{{end}}
</div>
<div class="grid grid-cols-1 gap-2 md:grid-cols-2">
{{range .Attributes}}
{{template "components/attribute_line" .}}
{{end}}
</div>
{{end}}
{{if .ListingComments}}
<div class="max-w-lg space-y-1.5 my-2">
{{range .ListingComments}}
<p class="block font-bold py-1.5 px-3 text-center text-sm border rounded-lg transition duration-300 border-white/30 bg-white/10 hover:bg-white/20 hover:border-white">
* {{.}} hello
</p>
<p
class="block font-bold py-1.5 px-3 text-center text-sm border rounded-lg transition duration-300 border-white/30 bg-white/10 hover:bg-white/20 hover:border-white">
* {{.}} hello
</p>
{{end}}
</div>
{{end}}
</section>
<div class="w-full my-2 border-t-2 border-opacity-50 border-dashed border-t-lime-400/10"></div>
<!-- ToS Checker -->
{{if gt (len .Service.TosHighlights) -10}}
<section class="flex flex-col items-center justify-center p-4 pb-4 mt-2 border-t-2 border-opacity-50 border-dashed border-t-lime-400/10" id="tos">
<section class="flex flex-col items-center justify-center p-4" id="tos">
<a href="/about#tos-checker" class="text-xl font-bold">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 calendar-cog" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 calendar-cog" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M12 21h-6a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v5"></path>
<path d="M16 3v4"></path>
@ -157,50 +181,57 @@
<path d="M17.27 20l-1.3 .75"></path>
<path d="M15.97 17.25l1.3 .75"></path>
<path d="M20.733 20l1.3 .75"></path>
</svg>
</svg>
<span>Automated ToS Checker</span>
<span class="text-xs text-white/30">?</span>
</a>
<p class="max-w-sm text-xs text-center text-gray-300 text-opacity-75">Automated, ai-driven weekly ToS checks.</p>
<p class="max-w-sm mt-1 text-xs text-center text-gray-400 text-opacity-75">Last Check: 2023-10-18</p>
{{if .Service.TosHighlights}}
<p class="max-w-sm text-xs text-center text-gray-300 text-opacity-75">Automated, ai-driven weekly ToS checks.</p>
<p class="max-w-sm mt-1 text-xs text-center text-gray-400 text-opacity-75">Last Check: 2023-10-18</p>
<div class="max-w-lg">
{{range .Service.TosHighlights}}
<div class="max-w-lg">
{{if .Affected}}
{{template "components/tos_check" .}}
{{end}}
</div>
{{end}}
{{else}}
<p class="max-w-md mt-2 font-bold text-center text-opacity-75 text-amber-400 text-md">This service does not have any ToS checks.</p>
{{if .Affected}}
{{template "components/tos_check" .}}
{{end}}
{{else}}
<p class="max-w-md mt-2 font-bold text-center text-opacity-75 text-amber-400 text-md">This service does not have any ToS checks.</p>
{{end}}
</div>
{{end}}
</section>
{{end}}
<div class="w-full my-2 border-t-2 border-opacity-50 border-dashed border-t-lime-400/10"></div>
<!-- Comments -->
<section class="flex flex-col items-center justify-center p-4 pb-4 mt-2 border-t-2 border-opacity-50 border-dashed border-t-lime-400/10" id="discuss">
<a href="https://usenostr.org" target="_blank" class="text-xl font-bold">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 messages" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M21 14l-3 -3h-7a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1h9a1 1 0 0 1 1 1v10"></path>
<path d="M14 15v2a1 1 0 0 1 -1 1h-7l-3 3v-10a1 1 0 0 1 1 -1h2"></path>
</svg>
<span>Nostr Comments</span>
<span class="text-xs text-white/30">?</span>
</a>
<h2 class="text-xl font-bold"></h2>
<p class="max-w-sm pb-4 mt-1 text-xs text-center text-gray-300 text-opacity-75">
Beware of fake reviews and accounts. Verify user profiles and conduct your own research.
</p>
<!-- div with the ID disgus where you would like to display the comments & form -->
<div id="disgus" class="max-w-xl">
<noscript>
<p class="font-bold text-center text-yellow-300">
You must have JavaScript enabled to see and use comments. It just will load a 200kb script to interact with Nostr. The source code is available <a target="_blank" class="underline" href="https://github.com/carlitoplatanito/disgus">here</a>.
</p>
</noscript>
</div>
<section
class="flex flex-col items-center justify-center p-4"
id="discuss">
<a href="https://usenostr.org" target="_blank" class="text-xl font-bold">
<svg xmlns="http://www.w3.org/2000/svg" class="inline-block w-4 h-4 messages" width="24" height="24"
viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
<path d="M21 14l-3 -3h-7a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1h9a1 1 0 0 1 1 1v10"></path>
<path d="M14 15v2a1 1 0 0 1 -1 1h-7l-3 3v-10a1 1 0 0 1 1 -1h2"></path>
</svg>
<span>Nostr Comments</span>
<span class="text-xs text-white/30">?</span>
</a>
<h2 class="text-xl font-bold"></h2>
<p class="max-w-sm pb-4 mt-1 text-xs text-center text-gray-300 text-opacity-75">
Beware of fake reviews and accounts. Verify user profiles and conduct your own research.
</p>
<!-- div with the ID disgus where you would like to display the comments & form -->
<div id="disgus" class="max-w-xl">
<noscript>
<p class="font-bold text-center text-yellow-300">
You must have JavaScript enabled to see and use comments. It just will load a 200kb script to interact
with Nostr. The source code is available <a target="_blank" class="underline"
href="https://github.com/carlitoplatanito/disgus">here</a>.
</p>
</noscript>
</div>
</section>
<!-- this can go at the end of the body -->