{{template "base/head" .}}
<div role="main" aria-label="{{.Title}}" class="page-content repository wiki">
	{{template "repo/header" .}}
	<div class="ui container">
		<div class="repo-button-row tw-flex tw-items-center tw-gap-2 tw-mb-4">
			<div class="tw-flex-1">
				<h2>{{svg "octicon-history" 20}} Recent changes</h2>
			</div>
			<a class="ui small button" href="{{.RepoLink}}/wiki/">
				{{svg "octicon-arrow-left" 14}} Back to wiki
			</a>
		</div>

		{{if .RecentChanges}}
		<table class="ui compact table">
			<thead>
				<tr>
					<th>Page</th>
					<th>Author</th>
					<th>Edit summary</th>
					<th>When</th>
					<th>Commit</th>
				</tr>
			</thead>
			<tbody>
				{{range .RecentChanges}}
				<tr>
					<td>
						{{if .PageURL}}
							{{svg "octicon-file" 14}}
							<a href="{{$.RepoLink}}/wiki/{{.PageURL}}">{{.PageName}}</a>
						{{else if .PageName}}
							{{svg "octicon-file" 14}} {{.PageName}}
						{{else}}
							<span class="text grey">—</span>
						{{end}}
					</td>
					<td>{{.Author}}</td>
					<td class="gt-ellipsis" style="max-width: 400px;">{{.Message}}</td>
					<td>{{DateUtils.TimeSince .When}}</td>
					<td><code class="tw-text-xs">{{.SHA}}</code></td>
				</tr>
				{{end}}
			</tbody>
		</table>

		<div class="tw-flex tw-justify-between tw-mt-4">
			{{if .HasPrevPage}}
				<a class="ui small button" href="{{.RepoLink}}/wiki/?action=_recent&page={{Eval .CurrentPage "-" 1}}">
					{{svg "octicon-chevron-left" 14}} Newer
				</a>
			{{else}}
				<span></span>
			{{end}}
			{{if .HasNextPage}}
				<a class="ui small button" href="{{.RepoLink}}/wiki/?action=_recent&page={{Eval .CurrentPage "+" 1}}">
					Older {{svg "octicon-chevron-right" 14}}
				</a>
			{{end}}
		</div>
		{{else}}
		<div class="ui placeholder segment">
			<div class="ui icon header">
				{{svg "octicon-history" 48}}
				<br>
				No recent changes
			</div>
		</div>
		{{end}}
	</div>
</div>
{{template "base/footer" .}}
