Implement contact matching

This commit is contained in:
2026-02-15 23:48:32 +00:00
parent 10af1e4d6b
commit b1a53034d5
12 changed files with 667 additions and 46 deletions

View File

@@ -0,0 +1,129 @@
{% extends "index.html" %}
{% block content %}
<section class="section">
<div class="container">
<div class="level" style="margin-bottom: 0.75rem;">
<div class="level-left">
<div>
<h1 class="title is-4" style="margin-bottom: 0.2rem;">Contact Match</h1>
<p class="is-size-7 has-text-grey">
Manually link Signal, WhatsApp, Instagram, and XMPP identifiers to people.
</p>
</div>
</div>
<div class="level-right">
<a class="button is-light" href="{% url 'compose_workspace' %}">
<span class="icon is-small"><i class="fa-solid fa-table-cells-large"></i></span>
<span>Manual Workspace</span>
</a>
</div>
</div>
{% if notice_message %}
<article class="notification is-{{ notice_level|default:'info' }} is-light">
{{ notice_message }}
</article>
{% endif %}
<div class="columns is-variable is-4">
<div class="column is-5">
<article class="box">
<h2 class="title is-6">Create Or Link Identifier</h2>
<form method="post">
{% csrf_token %}
<div class="field">
<label class="label is-small">Service</label>
<div class="select is-fullwidth">
<select name="service" required>
{% for key, label in service_choices %}
<option value="{{ key }}" {% if key == prefill_service %}selected{% endif %}>
{{ label }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="field">
<label class="label is-small">Identifier</label>
<div class="control">
<input class="input" type="text" name="identifier" value="{{ prefill_identifier }}" required>
</div>
</div>
<div class="field">
<label class="label is-small">Existing Person</label>
<div class="select is-fullwidth">
<select name="person_id">
<option value="">- Select person -</option>
{% for person in people %}
<option value="{{ person.id }}">{{ person.name }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="field">
<label class="label is-small">Or Create Person</label>
<div class="control">
<input class="input" type="text" name="person_name" placeholder="New person name">
</div>
</div>
<button class="button is-link" type="submit">
<span class="icon is-small"><i class="fa-solid fa-link"></i></span>
<span>Save Match</span>
</button>
</form>
</article>
</div>
<div class="column is-7">
<article class="box">
<h2 class="title is-6">Discovered Contacts</h2>
{% if candidates %}
<div class="table-container">
<table class="table is-fullwidth is-hoverable is-striped">
<thead>
<tr>
<th>Contact</th>
<th>Service</th>
<th>Identifier</th>
<th>Status</th>
<th></th>
</tr>
</thead>
<tbody>
{% for row in candidates %}
<tr>
<td>{{ row.person_name }}</td>
<td>
<span class="icon is-small"><i class="{{ row.service_icon_class }}"></i></span>
{{ row.service|title }}
</td>
<td><code>{{ row.identifier }}</code></td>
<td>
{% if row.linked_person %}
<span class="tag is-success is-light">linked</span>
{% else %}
<span class="tag is-warning is-light">unlinked</span>
{% endif %}
</td>
<td>
<a class="button is-small is-light" href="{{ row.compose_url }}">
<span class="icon is-small"><i class="fa-solid fa-paper-plane"></i></span>
<span>Message</span>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<p class="has-text-grey">No contacts discovered yet.</p>
{% endif %}
</article>
</div>
</div>
</div>
</section>
{% endblock %}