Skip to content

Commit

Permalink
add option and refactor steam importer part in users/data.html
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-yun committed Feb 11, 2025
1 parent aaf8937 commit 980ca00
Showing 1 changed file with 135 additions and 62 deletions.
197 changes: 135 additions & 62 deletions users/templates/users/data.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,85 +216,158 @@
<article>
<details>
<summary>{% trans 'Import from Steam Wishlist / Library (owned games only)' %}</summary>
<!-- For disabling form entries -->
<script src="{{ cdn_url }}/npm/[email protected]/dist/cdn.min.js" defer></script>
<form action="{% url 'users:import_steam' %}" method="post">
{% csrf_token %}
<div>
{% trans 'Steam API Key' %}
<br>
<small>
<!-- Steam API Key Section -->
<div class="form-section">
<b>{% trans 'Steam API Key' %}</b>
<small class="form-hint">
<a href="https://steamcommunity.com/dev/apikey"
target="_blank"
rel="noopener noreferrer">{% trans 'Get it here' %}</a>
</small>
<input type="str"
<input type="text"
name="steam_apikey"
value=""
placeholder="1A23B456C7890D9AS9D734BI3IB12943"
required>
{% trans 'Steam User ID' %}
<br>
<small>
{% trans 'Find as \'Steam ID: ...\' in ' %} <a href="https://store.steampowered.com/account/"
target="_blank"
rel="noopener noreferrer">{% trans 'Account Details' %}</a>
</div>
<!-- Steam User ID Section -->
<div class="form-section">
<b>{% trans 'Steam User ID' %}</b>
<small class="form-hint">
{% trans 'Find as "Steam ID: ..." in ' %}
<a href="https://store.steampowered.com/account/"
target="_blank"
rel="noopener noreferrer">{% trans 'Account Details' %}</a>
</small>
<input type="str"
name="steam_id"
value=""
placeholder="0123456789101112"
required>
<input type="text" name="steam_id" placeholder="0123456789101112" required>
</div>
<p>
{% trans 'To import...' %}:
<br>
<label for="id_import_wishlist">
<hr>
<!-- Source Filter -->
<div class="form-section" x-data="{ fetch_owned: true }">
<b>{% trans 'Sources to import from' %}</b>
<label class="checkbox-group">
<input type="checkbox"
name="fetch_wishlist"
value="True"
required=""
id="id_import_wishlist"
checked>
{% trans 'Wishlist' %}
</label>
<label for="id_import_owned">
<input type="checkbox"
name="fetch_owned"
value="True"
required=""
id="id_import_owned">
{% trans 'Owned games in library' %}
</label>
</p>
<p>
{% trans 'Visibility' %}:
<br>
<label for="id_visibility_0">
<input type="radio"
name="visibility"
value="0"
required=""
id="id_visibility_0"
x-model="fetch_wishlist"
checked>
{% trans 'Public' %}
{% trans 'Fetch wishlist' %}
</label>
<label for="id_visibility_1">
<input type="radio"
name="visibility"
value="1"
required=""
id="id_visibility_1">
{% trans 'Followers Only' %}
<label class="checkbox-group">
<input type="checkbox" name="fetch_owned" x-model="fetch_owned" checked>
{% trans 'Fetch owned games' %}
<div style="margin-left: 1.5rem;">
<label x-bind:aria-disabled="!fetch_owned.toString()">
<input type="radio"
name="owned_filter"
value="all_free"
x-bind:disabled="!fetch_owned">
{% trans 'Fetch all free games' %}
</label>
<label x-bind:aria-disabled="!fetch_owned.toString()">
<input type="radio"
name="owned_filter"
value="played_free"
checked
x-bind:disabled="!fetch_owned">
{% trans 'Fetch played free games' %}
</label>
<label x-bind:aria-disabled="!fetch_owned.toString()">
<input type="radio"
name="owned_filter"
value="no_free"
x-bind:disabled="!fetch_owned">
{% trans 'Fetch no free games' %}
</label>
</div>
</label>
<label for="id_visibility_2">
<input type="radio"
name="visibility"
value="2"
required=""
id="id_visibility_2">
{% trans 'Mentioned Only' %}
</div>
<!-- Status Filter -->
<div class="form-section">
<b>{% trans 'Import games with these estimated status' %}</b>
<div class="checkbox-group grid">
<label>
<input type="checkbox" name="import_playing" checked>
{% trans 'Playing' %}
</label>
<label>
<input type="checkbox" name="import_played" checked>
{% trans 'Played' %}
</label>
<label>
<input type="checkbox" name="import_wishlist" checked>
{% trans 'To play' %}
</label>
<label>
<input type="checkbox" name="import_dropped" checked>
{% trans 'Dropped' %}
</label>
</div>
</div>
<!-- Ignored Games -->
<div class="form-section">
<b>{% trans 'Ignored Games' %}</b>
<small>{% trans 'input comma-separated Steam AppIDs' %}</small>
<input type="text" name="ignored_appids" placeholder="12345,67890,54321">
</div>
<hr>
<!-- Reverse Override -->
<div class="form-section">
<b>{% trans 'Override' %}</b>
<label class="checkbox-group">
<input type="checkbox" role="switch" name="allow_reverse_override">
{% trans 'Allow reverse override of status (e.g. playing -> want to, or played -> playing)' %}
</label>
</p>
<input type="submit" value="{% trans 'Import' %}" />
</div>
<hr>
<!-- Mark Date -->
<div class="form-section">
<b>{% trans 'Mark Date' %}</b>
<div class="radio-group" x-data="{mark_date: 'steam_timestamp'}">
<label>
<input type="radio"
name="mark_date"
x-model="mark_date"
value="current_time">
{% trans 'Current time (not recommended)' %}
</label>
<label>
<input type="radio"
name="mark_date"
x-model="mark_date"
value="steam_timestamp"
checked>
{% trans 'Using timestamp from Steam' %}
<select name="timezone" x-bind:disabled="mark_date !== 'steam_timestamp'">
<option>UTC</option>
<option>EST</option>
<option>PST</option>
</select>
</label>
</div>
</div>
<hr>
<!-- Visibility -->
<div class="form-section">
<b>{% trans 'Visibility' %}</b>
<div class="radio-group">
<label>
<input type="radio" name="visibility" value="0" checked>
{% trans 'Public' %}
</label>
<label>
<input type="radio" name="visibility" value="1">
{% trans 'Followers Only' %}
</label>
<label>
<input type="radio" name="visibility" value="2">
{% trans 'Mentioned Only' %}
</label>
</div>
</div>
<button type="submit" class="submit-button">{% trans 'Import' %}</button>
</form>
</details>
</article>
Expand Down

0 comments on commit 980ca00

Please sign in to comment.