Contact card details

This commit is contained in:
Ian Gulliver
2024-11-22 21:14:28 -08:00
parent 43b34d1d9e
commit f261131d42
2 changed files with 80 additions and 3 deletions

View File

@@ -110,6 +110,10 @@ func (ph *PHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var allowedEnvs = []string{ var allowedEnvs = []string{
"CONTACT_PHONE", "CONTACT_PHONE",
"CONTACT_SMS",
"CONTACT_IMESSAGE",
"CONTACT_WHATSAPP",
"CONTACT_PAGE_EMAIL",
} }
func (ph *PHandler) envs() map[string]string { func (ph *PHandler) envs() map[string]string {

View File

@@ -17,6 +17,18 @@ body {
a { a {
color: inherit; color: inherit;
text-decoration: none; text-decoration: none;
display: flex;
flex-direction: row;
align-items: center;
}
.contact {
margin-bottom: 10px;
white-space: nowrap;
}
.contact svg {
margin-right: 10px;
} }
</style> </style>
<title>Page Ian</title> <title>Page Ian</title>
@@ -96,14 +108,75 @@ async function pageIan() {
</sl-alert> </sl-alert>
</sl-tab-panel> </sl-tab-panel>
<sl-tab-panel name="contact" style="text-align: center"> <sl-tab-panel name="contact" style="text-align: center">
<sl-card class="card-basic" style="font: 16px var(--sl-font-mono)"> <sl-card class="card-basic" style="font: 16px var(--sl-font-mono); text-align: left">
{{if .CONTACT_PHONE}} {{if .CONTACT_PHONE}}
<div> <div class="contact">
<a href="tel:{{.CONTACT_PHONE | replaceAll " " "" | replaceAll "-" ""}}"> <a href="tel:{{.CONTACT_PHONE | replaceAll " " "" | replaceAll "-" ""}}">
<sl-icon name="telephone" style="padding-right: 10px"></sl-icon> {{.CONTACT_PHONE}} <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M3.654 1.328a.678.678 0 0 0-1.015-.063L1.605 2.3c-.483.484-.661 1.169-.45 1.77a17.6 17.6 0 0 0 4.168 6.608 17.6 17.6 0 0 0 6.608 4.168c.601.211 1.286.033 1.77-.45l1.034-1.034a.678.678 0 0 0-.063-1.015l-2.307-1.794a.68.68 0 0 0-.58-.122l-2.19.547a1.75 1.75 0 0 1-1.657-.459L5.482 8.062a1.75 1.75 0 0 1-.46-1.657l.548-2.19a.68.68 0 0 0-.122-.58zM1.884.511a1.745 1.745 0 0 1 2.612.163L6.29 2.98c.329.423.445.974.315 1.494l-.547 2.19a.68.68 0 0 0 .178.643l2.457 2.457a.68.68 0 0 0 .644.178l2.189-.547a1.75 1.75 0 0 1 1.494.315l2.306 1.794c.829.645.905 1.87.163 2.611l-1.034 1.034c-.74.74-1.846 1.065-2.877.702a18.6 18.6 0 0 1-7.01-4.42 18.6 18.6 0 0 1-4.42-7.009c-.362-1.03-.037-2.137.703-2.877z" />
</svg>
{{.CONTACT_PHONE}}
</a> </a>
</div> </div>
{{end}} {{end}}
{{if .CONTACT_SMS}}
<div class="contact">
<a href="sms:{{.CONTACT_SMS | replaceAll " " "" | replaceAll "-" ""}}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M14 1a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4.414A2 2 0 0 0 3 11.586l-2 2V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12.793a.5.5 0 0 0 .854.353l2.853-2.853A1 1 0 0 1 4.414 12H14a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z" />
</svg>
{{.CONTACT_SMS}}
</a>
</div>
{{end}}
{{if .CONTACT_IMESSAGE}}
<div class="contact">
<a href="imessage:{{.CONTACT_IMESSAGE | replaceAll " " "" | replaceAll "-" ""}}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M2.678 11.894a1 1 0 0 1 .287.801 11 11 0 0 1-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 0 1 .71-.074A8 8 0 0 0 8 14c3.996 0 7-2.807 7-6s-3.004-6-7-6-7 2.808-7 6c0 1.468.617 2.83 1.678 3.894m-.493 3.905a22 22 0 0 1-.713.129c-.2.032-.352-.176-.273-.362a10 10 0 0 0 .244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9 9 0 0 1-2.347-.306c-.52.263-1.639.742-3.468 1.105" />
</svg>
{{.CONTACT_IMESSAGE}}
</a>
</div>
{{end}}
{{if .CONTACT_WHATSAPP}}
<div class="contact">
<a href="https://wa.me/{{.CONTACT_WHATSAPP | replaceAll " " "" | replaceAll "-" "" | replaceAll "+" ""}}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
<path d="M13.601 2.326A7.85 7.85 0 0 0 7.994 0C3.627 0 .068 3.558.064 7.926c0 1.399.366 2.76 1.057 3.965L0 16l4.204-1.102a7.9 7.9 0 0 0 3.79.965h.004c4.368 0 7.926-3.558 7.93-7.93A7.9 7.9 0 0 0 13.6 2.326zM7.994 14.521a6.6 6.6 0 0 1-3.356-.92l-.24-.144-2.494.654.666-2.433-.156-.251a6.56 6.56 0 0 1-1.007-3.505c0-3.626 2.957-6.584 6.591-6.584a6.56 6.56 0 0 1 4.66 1.931 6.56 6.56 0 0 1 1.928 4.66c-.004 3.639-2.961 6.592-6.592 6.592m3.615-4.934c-.197-.099-1.17-.578-1.353-.646-.182-.065-.315-.099-.445.099-.133.197-.513.646-.627.775-.114.133-.232.148-.43.05-.197-.1-.836-.308-1.592-.985-.59-.525-.985-1.175-1.103-1.372-.114-.198-.011-.304.088-.403.087-.088.197-.232.296-.346.1-.114.133-.198.198-.33.065-.134.034-.248-.015-.347-.05-.099-.445-1.076-.612-1.47-.16-.389-.323-.335-.445-.34-.114-.007-.247-.007-.38-.007a.73.73 0 0 0-.529.247c-.182.198-.691.677-.691 1.654s.71 1.916.81 2.049c.098.133 1.394 2.132 3.383 2.992.47.205.84.326 1.129.418.475.152.904.129 1.246.08.38-.058 1.171-.48 1.338-.943.164-.464.164-.86.114-.943-.049-.084-.182-.133-.38-.232" />
</svg>
{{.CONTACT_WHATSAPP}}
</a>
</div>
{{end}}
{{if .CONTACT_PAGE_EMAIL}}
<div class="contact">
<a href="mailto:{{.CONTACT_PAGE_EMAIL}}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-envelope-exclamation" viewBox="0 0 16 16">
<path d="M2 2a2 2 0 0 0-2 2v8.01A2 2 0 0 0 2 14h5.5a.5.5 0 0 0 0-1H2a1 1 0 0 1-.966-.741l5.64-3.471L8 9.583l7-4.2V8.5a.5.5 0 0 0 1 0V4a2 2 0 0 0-2-2zm3.708 6.208L1 11.105V5.383zM1 4.217V4a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v.217l-7 4.2z"/>
<path d="M12.5 16a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7m.5-5v1.5a.5.5 0 0 1-1 0V11a.5.5 0 0 1 1 0m0 3a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0"/>
</svg>
{{.CONTACT_PAGE_EMAIL}}
</a>
</div>
{{end}}
<div class="contact" style="display: flex; flex-direction: row; align-items: center;">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-terminal" viewBox="0 0 16 16">
<path d="M6 9a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3A.5.5 0 0 1 6 9M3.854 4.146a.5.5 0 1 0-.708.708L4.793 6.5 3.146 8.146a.5.5 0 1 0 .708.708l2-2a.5.5 0 0 0 0-.708z"/>
<path d="M2 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2zm12 1a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1z"/>
</svg>
<span id="curl"></span>
<sl-copy-button id="tmp" from="curl"></sl-copy-button>
<script>
document.getElementById('curl').innerText = `curl -d 'msg=Test page' ${window.location.href}`;
</script>
</div>
</sl-card> </sl-card>
</sl-tab-panel> </sl-tab-panel>
</sl-tab-group> </sl-tab-group>