chat: minor visual tweaks

This commit is contained in:
Kyle Drake 2024-03-28 10:37:44 -05:00
commit 2b2954b0fd
7 changed files with 64 additions and 27 deletions

View file

@ -0,0 +1,15 @@
Sequel.migration do
up {
alter_table(:sites) do
set_column_type :hits, :bigint
set_column_type :views, :bigint
end
}
down {
alter_table(:sites) do
set_column_type :hits, Integer
set_column_type :views, Integer
end
}
end

View file

@ -8,10 +8,9 @@ class Site < Sequel::Model
include Sequel::ParanoidDelete
VALID_MIME_TYPES = %w{
application/atom+xml
application/epub
application/epub+zip
application/font-sfnt
application/javascript
application/json
application/octet-stream
application/opensearchdescription+xml
@ -21,10 +20,13 @@ class Site < Sequel::Model
application/rss+xml
application/vnd.ms-fontobject
application/vnd.ms-opentype
application/x-elc
application/x-font-ttf
application/xml
audio/midi
font/otf
font/sfnt
font/ttf
font/woff
font/woff2
image/apng
image/avif
image/gif
@ -38,10 +40,10 @@ class Site < Sequel::Model
image/x-xcf
message/rfc822
text/cache-manifest
text/cache-manifest
text/css
text/csv
text/html
text/javascript
text/plain
text/tsv
text/xml
@ -77,7 +79,7 @@ class Site < Sequel::Model
INDEX_HTML_REGEX = /\/?index.html$/
ROOT_INDEX_HTML_REGEX = /^\/?index.html$/
MAX_COMMENT_SIZE = 420 # Used to be the limit for Facebook.. no comment (PUN NOT INTENDED).
MAX_FOLLOWS = 1000
MAX_FOLLOWS = 2000
BROWSE_MINIMUM_VIEWS = 100
BROWSE_MINIMUM_FOLLOWER_VIEWS = 10_000

View file

@ -2316,7 +2316,6 @@ pre, code {
.chat-box {
height: calc(100vh - 180px);
overflow-y: scroll;
padding: 10px;
background-color: #1d1f21;
font-weight: 300;
font-size: 13.5px;

View file

@ -1,22 +1,26 @@
<% site_followings = site.followings_dataset.count %>
<% if (!is_current_site && site_followings > 0) || is_current_site %>
<% site_followings_count = site.followings_dataset.count %>
<% if (!is_current_site && site_followings_count > 0) || is_current_site %>
<div class="following-list">
<h3><a href="/site/<%= site.username %>/follows"><%= is_current_site ? 'Sites you follow' : 'This site follows' %></a></h3>
<% if site_followings == 0 %>
<% if site_followings_count == 0 %>
<p>You are not following any sites yet. Add some by <a href="/browse">browsing sites</a> or looking at your tags.
<% else %>
<% site.followings_dataset.select(:site_id).all.each do |following| %>
<% site.followings_dataset.select(:site_id).limit(Site::MAX_DISPLAY_FOLLOWS).each do |following| %>
<a href="/site/<%= following.site_dataset.select(:username).first.username %>" title="<%= following.site.title %>"><img src="<%= following.site.screenshot_url 'index.html', '50x50' %>" class="avatar"></a>
<% end %>
<% if Site::MAX_DISPLAY_FOLLOWS < site_followings_count %>
<a href="/site/<%= site.username %>/followers"><strong>see more <i class="fa fa-arrow-right"></i></strong></a>
<% end %>
<% end %>
</div>
<% end %>
<% site_follows = site.follows_dataset.count %>
<% if (!is_current_site && site_follows > 0) || is_current_site %>
<% site_follows_count = site.follows_dataset.count %>
<% if (!is_current_site && site_follows_count > 0) || is_current_site %>
<div class="follower-list">
<h3><a href="/site/<%= site.username %>/followers">Followers</a></h3>
<% if site_follows == 0 %>
<% if site_follows_count == 0 %>
No followers yet.
<% else %>
<% site_profile_follows_actioning_ids = site.profile_follows_actioning_ids %>

View file

@ -111,10 +111,10 @@
<div class="row editor">
<div class="col left-col" style="width: 66%;">
<div class="col left-col" style="width: 70%;">
<div id="editor"><h3>Loading...</h3></div>
</div>
<div class="col right-col chat-container" style="width: 33%;">
<div class="col right-col chat-container" style="width: 30%;">
<div class="resize-handle"></div>
<div id="chat-box" class="chat-box">
<div class="bot-message message">

View file

@ -7,8 +7,8 @@
<div class="dialogue" style="top: 20px; left: 360px">
Your Neocities web directory already includes an image called <strong>neocities.png</strong>.
</div>
<div class="dialogue" style="top: 145px; left: 390px; width:200px">
Add it to your page like so: <pre><code class="html">&lt;img src="/neocities.png"&gt;</code></pre>
<div class="dialogue" style="top: 145px; left: 360px; width:250px">
Add it to your page: <pre><code class="html">&lt;img src="/neocities.png"&gt;</code></pre>
</div>
<div class="dialogue" style="top: 230px; left: 420px">
That's it! No closing tag needed for images.

View file

@ -18,23 +18,40 @@
$('h3#sitePreview').css('display', 'none')
$('.preview').css('margin-top', '20px')
$('#saveToSite').on('click', function() {
$('#saveToSite').on('click', function(event) {
event.preventDefault()
var formData = new FormData()
var fileContent = sessionStorage.getItem('tutorialHtml')
formData.append('index.html', new File([fileContent], 'index.html', { type: 'text/html' }))
formData.append('csrf_token', '<%= escape_javascript csrf_token %>')
formData.append('username', '<%= escape_javascript current_site.username %>')
$.ajax({
url: '/site_files/upload?csrf_token=<%= Rack::Utils.escape csrf_token %>&filename=<%= Rack::Utils.escape 'index.html' %>&site_id=<%= current_site.id %>',
data: sessionStorage.getItem('tutorialHtml'),
url: '/api/upload',
data: formData,
processData: false,
contentType: false,
type: 'POST',
error: function(jqXHR, textStatus, errorThrown) {
alert('There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!')
var errorMessage = 'There has been an error saving your file, please try again. If it continues to fail, make a copy of the file locally so you don\'t lose your changes!'
if(jqXHR.responseText) {
try {
// Attempt to parse the JSON responseText to get the error message
var parsedResponse = JSON.parse(jqXHR.responseText);
errorMessage += ' ERROR MESSAGE: ' + parsedResponse.message;
alert(errorMessage)
} catch (error) {
}
}
alert(errorMessage)
},
success: function(response){
success: function(response, textStatus, xhr){
window.location = '/tutorial/html/10'
}
})
return false
})
})
</script>